curve fitting for two datasets

Hello!
I am interested in "double fitting" curves to data. I have two sets of data: {X(i),Y1(i)} and {X(i),Y2(i)} (same x values, two different Y values for each).
I am interested in finding the best curves for two theoretical functions having some set of parameters. The two sets of parameters have some constraints. More specifically:
y1=f(x;a,b,c) y2=f(x;a,b,d)
where c=1-d.
Same function for both data sets, different parameters. So the fit should take into accound the two sets of data, and find the most suitable parameters a,b and c for the model.
Thanks!

1 件のコメント

Matt J
Matt J 2012 年 10 月 2 日
What MATLAB toolboxes are available to you for this (Optimization, Curve Fit, etc...)?

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

 採用された回答

yair
yair 2012 年 10 月 9 日

0 投票

Thanks a lot, This has been very useful!
Is there a way of adding constraints to the values of the parameters? (for example, b and c can receive only positive values, etc.)

3 件のコメント

Matt J
Matt J 2012 年 10 月 9 日
編集済み: Matt J 2012 年 10 月 9 日
FYI, because you're new: you should be responding to my Answer with Comments under that Answer, rather than with Answers of your own. That's what this board uses to thread different Answers, and to distinguish between Answers and non-Answers. You should also be aware of the feature of "Accept"-clicking on answers that you like :-)
As for your question about constraints, you should see in the documentation that there are input arguments to LSQCURVEFIT and the other functions I mentioned to you that let you specify bounds and constraints. You would set lb to zeros if you want the parameters to be constrained >=0 etc...
yair
yair 2012 年 10 月 11 日
Thanks!
Matt J
Matt J 2012 年 10 月 11 日
編集済み: Matt J 2012 年 10 月 11 日
You're welcome, but another tip for the future: if you want to give credit to someone for a good answer, you need to Accept-click their answer, not your own :-)

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

その他の回答 (2 件)

Matt J
Matt J 2012 年 10 月 2 日
編集済み: Matt J 2012 年 10 月 2 日

0 投票

If you have LSQCURVEFIT, I think you can just concatenate the 2 data sets into a single one. I don't see any requirement in the documentation that the xdata be monotonically distributed over an interval:
xdata=[X(:);X(:)];
ydata=[Y1(:);Y2(:)];
fun=... %returns concatenation of f(x,a,b,c) and f(x, a,b,1-c)
x = lsqcurvefit(fun,x0,xdata,ydata);
You could always cross-check the result using LSQNONLIN.
yair
yair 2012 年 10 月 2 日

0 投票

Thank you for the quick answer!
I was not familiar with the lsqcurvefit, I will try to learn it.
Up to now I have used the curve fitting toolbox, is there any way of performing the "double fit" using this toolbox?

1 件のコメント

Matt J
Matt J 2012 年 10 月 2 日
I can't see how you'd do it with the Curve Fitting toolbox, but I'm much less familiar with that toolbox.

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

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

質問済み:

2012 年 10 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by