Finding exponential curve and r-squared using polyfit
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have been trying to figure out how to find the exponential regression and r-squared given a set of x and y values as t and P. The equation I am given is P = a*e^(-b/t) This is my code
temp = [10:10:200];
pres = [1.227, 2.337, 4.241, 7.375, 12.340, 19.920,31.160,47.360, 70.110,101.330,143.270,198.540,270.130,361.380,476.000,618.060,792.020,1002.700,1255.100,1554.900]
tnew = 1.0 ./ (273.15+temp)
logp = log(pres)
AB = polyfit(tnew, logp, 1)
a = exp(AB(1))
b = -AB(2)
curve = a * exp(b./tnew)
r2 = 1 - sum(((a-b)./tnew-logp).^2)/ sum(( logp- mean(logp)).^2)
Can anyone help me out?
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!