Home > other >  There is an error in the using matlab nlinfit
There is an error in the using matlab nlinfit

Time:10-09

X=[3.9, 5.3, 7.2, 9.6, 12.9, 17.1, 23.2, 31.4, 38.6, 50.2, 62.9, 76.0, 92.0,...
106.5, 123.2, 131.7, 150.7, 179.3, 204.0, 226.5, 251.4, 281.4, 309.35] ';
N=length (x);
Y=x (1, n); % data from 1790 to 2010,
T=(1, n) ';
Beta0=[5.3, 0.22, 400,]; % [x0, r, xm]
[beta, R, J]=nlinfit (t, y, 'logisfun beta0);
% R for residual, beta for six parameters
P y=beta (3)/(1 + (beta (3)/beta (1) - 1) * exp (- beta (2) * t)); % predicted population in each of the
P24=beta (3)/(1 + (beta (3)/beta (1) - 1) * exp (- beta (2) * 24));
% forecast 2020 populationRmse=SQRT (sum (R ^ 2)/n); % root mean square error (mse)
The plot (1: n, y, '*', 1: n, p y); % compare figure


% logisfun. The mThe function yhat=logisfun (beta, x)
Yhat=beta (3)/(1 + (beta (3)/beta (1) - 1). * exp (- beta (2) * x));
Completely copy this step wrong: The model function 'logisfun' was not found
  • Related