Exponential/Power curve fitting from data
古いコメントを表示
Hey
I would like some help on finding some unknown constants in an equation, from some data i have.
The function I have is the following
y = k1 * d1^(k2/2) * d2^(k3/2) * d3^k4
from measurements i have [y d1 d2 d3] and i need to know [k1 k2 k3 k4].
I tried to solve this function in excel using the LOGEST function and it solves for
y = b * m1^x1 * m2^x2...etc
where mn is the unknowns.
What i did there was to set exp(ln) the function to get it the way i needed to be and it solved it just fine.
What i want to do is the same thing except in matlab. I'm kinda lost on what function to use and so on.
Because it requires start values and only one in-value (x) while i have 3 different values.
This is as far as i came before i got stuck
% k = [k1 k2 k3 k4]
% d = [data1 data2 data3]
% y
% y and d known and in a list
modelfun = @(k,d)
k(1)*exp(p(1)*k(2))*exp(p(2)*k(3))*exp(p(3)*k(4))
start = [2 0.2 1.5 -.5]
coef = nlinfit(???,y,modelfun,start)
the thing is i wanna be able to plot y against any of those three.
Thanks
Sorry for the bad english
回答 (4 件)
Mamed
2011 年 10 月 25 日
Daniel Shub
2011 年 10 月 25 日
I think if you log transform everything you can eliminate the fminsearch and treat the problem as optimizing a linear equation. Basically rewrite
y = k1 * d1^(k2/2) * d2^(k3/2) * d3^k4
as
log(y) = log(k1)+(k2/2)*d1+(k3/2)d2+(k4)*d3;
and solve for log(k1), k2, k3, k4 with techniques designed for linear equations.
Mamed
2011 年 10 月 25 日
2 件のコメント
Daniel Shub
2011 年 10 月 25 日
Don't do a fitting procedure (e.g., lsqnonlin). In this form, all you need to do is a linear regression. You can explicitly solve for the optimum parameters.
Mamed
2011 年 11 月 2 日
Mamed
2012 年 1 月 17 日
0 投票
1 件のコメント
Walter Roberson
2012 年 1 月 17 日
I think you should probably start a new Question for this topic.
カテゴリ
ヘルプ センター および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!