How do I do an exponential fit for my data?

5 vues (au cours des 30 derniers jours)
Soleil Hernandez
Soleil Hernandez le 21 Juin 2016
Commenté : Star Strider le 22 Juin 2016
here is my code:A=[ 0.734 2.956 132.351 6.1775 1.385 1.79887 5.122 12.2774 5.1001 6.07515 10.232 20.3542 9.688 0.983 51.3152 7.42856 16.5368 6.44541 6.19359 7.7353 10.5964 5.5078 55.8428 4.35722 2.83427 1.88594 19.367 1.89 24.5355 30.6559 34.2349 7.1513 2.2275 30.2956 3.16718 18.1018 ];
C=[ 4039 1896 2322 2961 3443 3020 1729 7097 1942 1956 2774 2787 2840 4313 1206 2204 2909 2454 2694 3224 2189 2686 2591 3210 3751 3321 1884 2780 1185 1358 1331 1960 3563 2483 4451 2589];
scatter(A,C) xlabel('Volume of GTV(cc)') ylabel('Total MU') title('Volume of GTV v. Total MU')
I would like to know how to do an exponential fit for my data. Thank you

Réponse acceptée

Star Strider
Star Strider le 21 Juin 2016
This is how I would do it:
A=[ 0.734 2.956 132.351 6.1775 1.385 1.79887 5.122 12.2774 5.1001 6.07515 10.232 20.3542 9.688 0.983 51.3152 7.42856 16.5368 6.44541 6.19359 7.7353 10.5964 5.5078 55.8428 4.35722 2.83427 1.88594 19.367 1.89 24.5355 30.6559 34.2349 7.1513 2.2275 30.2956 3.16718 18.1018 ];
C=[ 4039 1896 2322 2961 3443 3020 1729 7097 1942 1956 2774 2787 2840 4313 1206 2204 2909 2454 2694 3224 2189 2686 2591 3210 3751 3321 1884 2780 1185 1358 1331 1960 3563 2483 4451 2589];
expfit = @(b,x) b(1) + b(2).*exp(b(3).*x + b(4));
SSECF = @(b) sum((C - expfit(b,A)).^2);
B0 = ones(4, 1);
B_est = fminsearch(SSECF, B0);
xpv = linspace(min(A), max(A));
figure(1)
plot(A, C, 'bp')
hold on
plot(xpv, expfit(B_est, xpv), '-r')
hold off
grid
xlabel('Volume of GTV(cc)')
ylabel('Total MU')
title('Volume of GTV v. Total MU')
text(mean(xlim)*0.9, mean(ylim), sprintf('\\Sigma MU = %.2f %+.2f\\cdote^{%+.4f\\cdotV_{GTV} %+.2f}', B_est))
  3 commentaires
Torsten
Torsten le 22 Juin 2016
You should work with the function
expfit = @(a,x) a(1) + a(2).*exp(a(3).*x);
b(2)*exp(b(4)) can be subsummed in one parameter a(2).
Best wishes
Torsten.
Star Strider
Star Strider le 22 Juin 2016
@Soleil Hernandez — Yes. Use 'b.' instead of 'bp'.
(I like stars because they’re easier to see in a saved image of a plot.)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by