How to do custom equation (non linear) regression?
古いコメントを表示
I need to find some constant from data that usually is shown in log-log scale, the equation related to the data would be y=(a*x^b)/(26.1-x). How do I find the a and b constants?
採用された回答
その他の回答 (2 件)
Assume these are your experimental data
x = linspace(0,20,30);
y = rand(size(x))/3+(pi*x.^(sqrt(2)/2))./(26.1-x);
figure(1)
plot(x,y,'or')
To find a and b you can do the following.
modelfun = @(p,x) (p(1)*x.^p(2))./(26.1-x);
par = nlinfit(x,y,modelfun,[1 1]);
a = par(1)
b = par(2)
figure(2)
plot(x,y,'or',x,modelfun(par,x),'k')
Image Analyst
2023 年 4 月 12 日
0 投票
I usually use fitnlm (fit non-linear model). You can specify the equation you want to fit to. I'm attaching some examples of fitnlm.
4 件のコメント
yehuda kristo
2023 年 4 月 12 日
Image Analyst
2023 年 4 月 12 日
I think you didn't replace the x and y in the program with your own data properly. Please attach your actual data in a .mat file.
yehuda kristo
2023 年 4 月 12 日
Image Analyst
2023 年 4 月 12 日
Well, looks like you're going to use Star's solution, so I won't bother, unless you really want me to.
カテゴリ
ヘルプ センター および File Exchange で Linear Predictive Coding についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


