Fitting Two Exponentials (find mid-pt and fit to reduce chi-sq)

1 view (last 30 days)
I wonder if there's a way to fit two (non-overlapping) exponentials to a single curve. Is there a fitting program on MATLAB user exchange that'll test fits for a mid-point, and refit or spit out something like this? Ulitmatley the fits should have a minimum chi-square? An example would be fitting to data looking like (imagine the data require fitting-obviously my script has boring data)
figure;
tmpx = 1:0.05:5;
tmpx2 = 5:0.05:10;
% construct one exp, and another
y1=exp(-1/100*tmpx);
y2=exp(-1/50*tmpx2);
% offset so they match-up (graphically)
y1 = y1 - (y1(end) - y2(1));
% add randomness for the spirit of fitting!
y1 = y1 + rand(size(y1))/100;
y2 = y2 + rand(size(y2))/75;
% Plot modded y1, and orignal y2 (notice they match up)
plot(tmpx,y1,'b.'); hold on;
plot(tmpx2,y2,'r.')
Thanks for any help. Michael

Answers (0)

Community Treasure Hunt

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

Start Hunting!