Non-linear curve fitting

12 ビュー (過去 30 日間)
Filip Jackowski
Filip Jackowski 2019 年 6 月 5 日
編集済み: Matt J 2019 年 6 月 5 日
I apologize in advance if there there are similar cases of this question already getting answered, I tried following along but had trouble applying the given solutions to my own issue and would really appreciate a step-by-step solution.
I have a case where I've gathered experimental data, x and y where both x and y are vectors and im trying to fit it to the equation y = c1 + (c2*x)/(1 + c3*x)
I need to find a way to solve for c1, c2, and c3. Any help would be tremendously appreciated
  1 件のコメント
Stephan
Stephan 2019 年 6 月 5 日
please provide the code you have tried so far.

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

採用された回答

Star Strider
Star Strider 2019 年 6 月 5 日
You need to define your model function as a function, then use some optimization function to fit the parameters.
Example:
yfcn = @(c1,c2,c3,x) c1 + (c2.*x)./(1 + c3.*x); % Model Function (Objective Function)
x = rand(10,1); % Create Data
y = rand(10,1); % Create Data
[B,fval] = fminsearch(@(b) norm(y - yfcn(b(1),b(2),b(3),x)), [1; 2; 1]); % Estimate Parameters
C1 = B(1)
C2 = B(2)
C3 = B(3)
There are many other functions you can use to estimate the parameters, including fmincon, fminunc, nlinfit, lsqcurvefit, and ga, as well as many others. See the documentation for the various functions (including norm here) to understand how to use them.

その他の回答 (1 件)

Matt J
Matt J 2019 年 6 月 5 日
編集済み: Matt J 2019 年 6 月 5 日
fminspleas would be good for this (Download Here)
c3_guess = ____; %As good a guess as you know of c3
flist={1,@(c3,x)x./(1+c3.*x)};
[c3,c12]=fminspleas(flist,c3_guess);
c=[c12,c3];

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by