How to fit 6 curves simultaneously to solve for 2 unknowns?

19 views (last 30 days)
Delores Davis
Delores Davis on 7 Jun 2015
Commented: Delores Davis on 30 Jun 2015
y=(1-exp(-0.5*Phi*Gain*(x-TimeDelay)^2))*Amax
Gain and TimeDelay are unknown. x is time (T1-T6) and y is response (F1-F6)(source of noise). Phi is different for each curve, and Amax is constant.
Attached is a sample dataset. The values for Phi and the Amax for this dataset are found to the right of the data.
I tried the Curve Fitting Toolbox, but it seems to be designed for one trace at a time. I can get the curves to fit for the first 4 traces but not the last 2. However, I need to get one gain value and one TimeDelay that is the best (or least bad) fit across all traces. I don't know what function to use.
Thank you! Any help is appreciated.
***note: I am editing the question with the comments from Walter taken into consideration. I initially typed the equation incorrectly (wrote Amax was negative and it isn't) and I also thought TimeDelay was constant and it isn't.
  2 Comments
Delores Davis
Delores Davis on 7 Jun 2015
My bad. I copied the data to an excel file and then forgot to attach it. It's here now.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 7 Jun 2015
Solve for Gain to get
Gain = -2*ln((Amax+y)/Amax)/(Phi*(x-TimeDelay)^2)
then make a single table of all of the values over all of the datasets, and run a least-squared fit. Looks like the solution to that would just be the mean of those values.
Per-variable confidence bounds is not as easy to compute. If I understand your setup correctly, "y" should be treated as having noise, but not the others?
  46 Comments
Delores Davis
Delores Davis on 30 Jun 2015
Step #1, minimum value 918155 near (Gain = 0, TimeDelay = 0)
Step #1: widening Gain search lower
Step #1: widening TimeDelay search lower
Step #2, minimum value 2.05049e+07 near (Gain = 0.003, TimeDelay = 0.0001)
Step #2: widening TimeDelay search higher
Step #3, minimum value 6.31486e+06 near (Gain = 0.00012, TimeDelay = 0.000106)
Step #3: widening TimeDelay search higher
Step #4, minimum value 498239 near (Gain = 4.8e-06, TimeDelay = 0.00010618)
Step #4: widening TimeDelay search higher
Step #5, minimum value 489409 near (Gain = 5.808e-06, TimeDelay = 0.000106185)
Step #5: widening TimeDelay search higher
Tried to test the reproducibility of this test on another animal, and it is obviously horrible, for un-obvious reasons. Do you have any idea why? I have attached the data for this other animal (wildtype so should fall into range with the data we've been working on).

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!