custom fitting to logarithmic fxn
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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,
0 commentaires
Réponse acceptée
bym
le 25 Juin 2011
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 commentaires
bym
le 26 Juin 2011
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!