Logistic Population growth... w. linear regression and polyfit

6 visualizaciones (últimos 30 días)
Kyle
Kyle el 4 de Feb. de 2014
Editada: Paul el 4 de Feb. de 2014
i've been giving the following initial data.
t=0:14; n=[105 118 139 164 189 214 240 265 290 316 330 348 363 369 373];
and have been asked to model. the following equation. and compare it to the curve produced by the above data set.
Nt+1=Nt+Nt(r-(r/K)*Nt) % for anyone unfamiliar this is an FDE.
i've also figured out that the above equation can be broken down into the equation below.
(Nt+1-Nt)/Nt=r-r/K*Nt ... where the left hand side can be identifed as the y axis and the RHS can be identified as the x- axis and that r and r/K can be determined through linear regression... and then K can be solved.
I've tried inputting coeff=polyfit(t,n,1) and get 21.1250 and 106.9917 as output. i feel like what i'm doing is right but my number don't make any sense. can anyone give me any feed back. any help is appreciated! thanks!
  4 comentarios
John D'Errico
John D'Errico el 4 de Feb. de 2014
Editada: John D'Errico el 4 de Feb. de 2014
(Nt + 1 - Nt)/(Nt) == 1/(Nt)
When t = 0, I wonder what happens? Very often when you have something that looks algebraically correct, it is still a poor thing to do using a computer.
Kyle
Kyle el 4 de Feb. de 2014
its an FDE. so when t=0, n=105.

Iniciar sesión para comentar.

Respuestas (1)

Paul
Paul el 4 de Feb. de 2014
Editada: Paul el 4 de Feb. de 2014
I dont understand what you want to do with the fit but the numbers are correct:
coeff=polyfit(t,n,1)
n_fit = polyval(coeff,t)
figure;plot(t,n)
hold on;
plot(t,n_fit,'r')
legend('data','fit')
As you can see the fit is the best linear fit you'll get. The first value of coeff is the slope and the second is the constant.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by