How do i fit an equation to a given curve?

5 ビュー (過去 30 日間)
Kyle
Kyle 2014 年 2 月 2 日
コメント済み: Walter Roberson 2014 年 2 月 2 日
I've been giving the following 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 fit the following two equations to this set of data.
1) N(t+1)= Nt=rNt
and
2) N(t+1)=Nt(1+r(1-Nt/k))
any advice on how to go about it. I can use polyfit and polyval to determine a fitted graph. but i have no idea how to relate it to the above equations. is there anyway i can determine an "r" value that will give me the best fitted results?
  6 件のコメント
Kyle
Kyle 2014 年 2 月 2 日
no its not the same. these are FDE's so the t is supposed to be a subscript. so each n ( in this example) is a population size at each interval of t. did u follow that. sorry its difficult to type it out.
Kyle
Kyle 2014 年 2 月 2 日
ohhh wait.you're just simplifying it, right? and yet your interpretation of the 2nd equation is correct. what are you trying to get at tho?

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2014 年 2 月 2 日
When
N(t+1) = (1+r)*N(t)
then
N(t) = (1+r)^t * N(0)
Take log...
log(N(t)) = t * log(1+r) + log(N(0))
This puts you in a position to do a linear fit to determine log(1+r), from which you can determine r.
  4 件のコメント
Kyle
Kyle 2014 年 2 月 2 日
and just plug in n and t too...?
Walter Roberson
Walter Roberson 2014 年 2 月 2 日
p = polyfit(t, log(n), 1);
r = exp(p(1)) - 1;
N0 = exp(p(2));
plot(t, (1+r).^t * N0, 'b', t, n, 'k.')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by