Fit an exponential curve
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sahar khalili
il 7 Lug 2021
Commentato: Star Strider
il 8 Lug 2021
Hi, I have a data set like this
x=[6.5 2.45 2.7 1.85 2.25 1.35 1.4 1 0.7 .475 .66 .475];
y=[0.40 0.80 1 1.40 1.80 2.50 3.00 4.00 6.00 7.00 8.00 9.00];
and I want to fit an exponential curve like this: y=6.5*e^(-a*x) to my data set. Since, the value 6.5 is constant I do not get my desired reslut from cftool. Does anybody know how can I solve this?
0 Commenti
Risposta accettata
Star Strider
il 7 Lug 2021
Try this —
x=[6.5 2.45 2.7 1.85 2.25 1.35 1.4 1 0.7 .475 .66 .475];
y=[0.40 0.80 1 1.40 1.80 2.50 3.00 4.00 6.00 7.00 8.00 9.00];
[fitobject,gof,output] = fit(x(:),y(:),'6.5*exp(-a*x)')
figure
plot(fitobject, x, y, 'p')
grid
.
2 Commenti
Più risposte (1)
Sulaymon Eshkabilov
il 7 Lug 2021
1st of all, your data's good fit is not 6.5*exp(a*x) that is why cftool is giving you the best fit that differs from your expected 6.5*exp(-a*x).
If you're aiming to get a fit for 6.5*exp(-a*x) then use "custom equation" option and set it to 6.5*exp(-a*x).
0 Commenti
Vedere anche
Categorie
Scopri di più su Interpolation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!