curve fitting for two datasets
Show older comments
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 Comment
Matt J
on 2 Oct 2012
What MATLAB toolboxes are available to you for this (Optimization, Curve Fit, etc...)?
Accepted Answer
More Answers (2)
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.
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!