MATLAB Answers

How to merge two similar functions into a same function? any mathematical modeling method or tool box?

3 views (last 30 days)
Qian
Qian on 23 Feb 2012
I had fitting curves from two sets of data with similar functions. I am wondering if there's any tool box or mathematical modeling method using Matlab to merge these two functions into one function. The two functions are as below:
f(x) = a*exp(b*x) + c*exp(d*x)
a = 105 (104.9, 105)
b = 0.002164 (0.002143, 0.002186)
c = 0.3552 (0.2752, 0.4352)
d = 0.02433 (0.02294, 0.02573)
g(x) = a*exp(b*x) + c*exp(d*x)
a = 112.7 (112.5, 112.9)
b = 0.002181 (0.002137, 0.002226)
c = 0.359 (0.1781, 0.5398)
d = 0.02852 (0.02452, 0.03253)
Thank you!

Answers (1)

Richard Willey
Richard Willey on 3 Apr 2012
Hi Qian
Implicitly, you seem to be suggesting that there is a single model that describes both of these sets of data. Rather than trying to combine the two functions after the fact, why not just fit a single curve to the combined data set? (Add in a dummy variable that codes whether the data is from set one or set two)
If you don't have the raw data available, I'd recommend generating 1000 data points consistent with the first curve, a thousand points that are consistent with the second curve, and fitting a regression to this new data set.

Community Treasure Hunt

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

Start Hunting!