model fitting using lsqnonlin

4 ビュー (過去 30 日間)
Monika K
Monika K 2015 年 7 月 3 日
コメント済み: Torsten 2015 年 7 月 3 日
y1=f(a,b,c,d,e,f,x,y,z) y2=f(a,b,c,g,h,i,x,y,z)
y1, y2 are known outputs. x,y,z are known inputs. a,b,c,d,e,f,g,h,i are the variables which I wish to find using lsqnonlin and lsqcurvefit. As there are two functions and variables are common, how shall I write fun in lsqnonlin(@fun,x0)? Thanks in advance

回答 (1 件)

Torsten
Torsten 2015 年 7 月 3 日
Concatenate y1 and y2 to y=[y1 y2] and x1 and x2 to x=[x1 x2] and proceed as usual.
Best wishes
Torsten.
  2 件のコメント
Monika K
Monika K 2015 年 7 月 3 日
Thanks for reply. I made mistake while asking que.. input x is itself matrix [x y z].
Torsten
Torsten 2015 年 7 月 3 日
In lsqnonlin, you could calculate the residuals as
for i=1:length(y1)
F(i)=y1(i)-f(a,b,c,d,e,f,x(i),y(i),z(i));
end
for i=1:lenghth(y2)
F(length(y1)+i)=y2(i)-f(a,b,c,g,h,i,x(i),y(i),z(i));
end
Best wishes
Torsten.

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

カテゴリ

Help Center および File ExchangeLinear Least Squares についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by