custom logarithmic fit with three coefficients
5 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I am trying to fit a custom logarithmic function
logfit2 = fittype('a + b*log(c*x)','dependent',{'y'},'independent',{'x'}, 'coefficients',{'a','b','c'});
fitulog2=fit(urot2,z,logfit2); plot(fitulog2,'magenta');
and the data are urot2 = [5.1689; 6.2631; 7.1724; 8.1874]; and z=[20;40;60;80]; I get the error:
Error using fit>iFit
Complex value computed by model function, fitting cannot continue.
Try using or tightening upper and lower bounds on coefficients.
Did anyone use the above function for fitting? How do I set lower and upper bounds on coefficients?
Thanks, Petr.
0 件のコメント
採用された回答
Torsten
2023 年 3 月 6 日
It doesn't make sense to use three fitting parameters for the function type you supply.
a + b*log(c*x) = a + b*log(c) + b*log(x)
So the fittype should be
u + v*log(x)
This way, you also circumvent the problem of a negative value for c which makes log(c*x) complex-valued (the reason for your error message).
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Linear and Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!