fitting implicit function to data

6 ビュー (過去 30 日間)
Moritz
Moritz 2013 年 12 月 14 日
回答済み: Moritz 2013 年 12 月 15 日
Dear all,
i am fitting an implicit function (SMA Isotherm) z(x,y) with lsqcurvefit but i wonder if there is a better solution. My data is of different size z.B x(10x1) y(7x1)!
i make an explicit expression with fsolve by looping over x and y like:
for n=1:length(x)
for i=1:length(y)
z(i,n)=fsolve(@(z)SomeExpression-z,0.001);
end
end
I then call it like
fitParam=lsqcurvefit(@(param,x)explizit_function(param,x,y),param,xmeasured,zmeasured)
Any hints are appreciated.
Kind regards
Moritz

採用された回答

Matt J
Matt J 2013 年 12 月 15 日
編集済み: Matt J 2013 年 12 月 15 日
If your implicit equation is
F(params,x,y,z)=0
and you have known data points (X(i),Y(i),Z(i)) that you want to fit, I think you would just use FSOLVE to solve the system of N equations
F(params,X(i),Y(i),(i))=0, i=1...N
for params.

その他の回答 (1 件)

Moritz
Moritz 2013 年 12 月 15 日
Yes, you are right. I did not see the forest because of all the trees. Actually it is a lot faster this way.
I use fmincon with constraints in order to avoid complex values. Instead of 16 seconds it now takes 0.6 seconds.
Thank you for this eye opener...

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by