Ingo
Ingo

Reputation: 1802

Fit exponential curve through data points in Matlab

Having data of an exponential decay available, I would like to fit a curve through it. How can I do that in Matlab?

Upvotes: 3

Views: 48361

Answers (5)

bubble
bubble

Reputation: 3526

Matlab has a function called polyfit. It can fit curve to a data which can be represented in the form a*X^n+b*X^(n-1)+.....z. However if you are sure that the data is of some exponential decay you can try taking logarithm of the data first and then using the polyfit function. I thing that will work.

Upvotes: 0

Adiel
Adiel

Reputation: 3071

Try this:

ft=fittype('exp1');
cf=fit(time,data,ft)

This is when time and data are your data vectors; time is the independent variable and data is the dependent variable.

This will give you the coefficients of the exponential decay curve.

Upvotes: 5

Marcin
Marcin

Reputation: 3524

cftool(X,Y) is the way to go. here's some linkage:

LINK1 LINK2

Upvotes: 1

regularfry
regularfry

Reputation: 3268

Linearise, least squares, delinearise :-)

Upvotes: 0

user389419
user389419

Reputation: 263

If by fit you mean least squares, you should try lsqcurvefit

Upvotes: 2

Related Questions