MATLAB: Representing a given curve as the sum of an exponential + gaussian curve

nonlinear curve fitsum of gaussian + exponential

Hi,
I have a given curve y(x) which behaves like an exponential curve until a point say x=.25 and then it follows a Gaussian distribution until the end (say x=8.25).
How do I use cfit(or any other method) to fit data into my curve?
My course of action was that split the range of x into 2 parts – part 1- x upto which there is exponential behavior and part 2 – later part of x for which there is a Gaussian nature.
So i found the coefficients for each case respectively(part 1 and part 2 using standard model fits like 'exp1' and 'Gauss1') i.e ( a and b for a*exp(b*x) and a1,b1,c1 for a1*exp(-((x-b1)/c1)^2) ) for different ranges of x (according to the behavior) .
And then used these coefficients in fitting in the cfit tool for my general model a*exp(b*x)+ a1*exp(-((x-b1)/c1)^2) for all range of x . But this does not give me the correct answer(which is obvious).
Basically i need to have a curve which can represent both exponential behavior as well as Gaussian nature using a single equation .How do i do this?
Thank you.

Best Answer

Your model would really be something like this
a*exp(b*x).*(x<=K)+ a1*exp(-((x-b1)/c1)^2).*(x>K)
where K is the transition point separating the two ranges. I think you would have to curve fit each piece separately as you've been doing, but to evaluate the curve using a single expression, you would use the above.
Related Question