custom fitting to logarithmic fxn

I need t fit a curve to some data. The equation is having form: level = A*(1- exp(-b*x))
where 'x' is independent variable. I need to find A and b values. Does any one know how to use lsqcurve fot or maybe something in the custom fitting tool box to accomplish this??
Thank You,

 채택된 답변

bym
bym 2011년 6월 25일

1 개 추천

clc;clear;close
data = 2.*(1-exp(-.3.*(1:10)));
data = data + .5.*rand(1,10);
myfun = @(a,x)a(1).*(1-exp(a(2).*x));
plot(data,'bo');hold
a0 = [1.5,-.1];
ahat = lsqcurvefit(myfun,a0,(1:10),data);
plot(myfun(ahat,(1:10)),'g--')

댓글 수: 2

John Crane
John Crane 2011년 6월 26일
Thank you, this is great. I was wondering why you started a(2) with a negative number for this case? I ask because the independent axis for me will be time(t) and I would like to get a parameter(maybe calle beta) that would give a measurement of the growth of the curve to reach it's maximum? Or plateau?
Thanks
bym
bym 2011년 6월 26일
I set a(2) to negative because that was the form of your equation. If you set the starting point to a positive number in my example, you don't get a very satisfactory result. a(2) or b using your nomenclature is the parameter you are looking for, it is called the rate parameter http://en.wikipedia.org/wiki/Exponential_distribution

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

제품

질문:

2011년 6월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by