Is it possible to express an exponential in terms of a quadratic?

2 vues (au cours des 30 derniers jours)
Matt
Matt le 2 Mar 2012
I am trying to see whether or not an exponential or a linear fit is the best fit for my data. I am going to be extrapolating the fit in order to obtain new values. I looked at the R-Squared values for all of my data sets and found that roughly 50% of the time a linear fit was better and roughly 50% of the time an exponential fit was best.
What I want to do now is to see whether or not the exponential curve shape is occurring within the confines of my data set or not in order to see if I should really be plotting an exponential or not. In order to do this I would like to convert my y = A*e^Bx into the quadratic y = A + Bx + Cx^2 so I can directly compare it with the linear fit y = A + Bx. the logic being that if A for the linear fit is similar to A for the exponential fit and B for the linear fit is similar to the B for the linear fit and C for the exponential fit is small then a exponential fit is not a suitable fit.
Now to the Matlab side of things, is there a simple way for me to convert this exponential into a quadratic in matlab please?
At present, what I have been doing is finding A and B for the exponential and then plotting points using that exponential equation and then plotting a quadratic through it. I'm not sure this is the best way to be doing this. Anybody know something I am missing?
Thanks in advance, Matt

Réponses (1)

Jonathan Sullivan
Jonathan Sullivan le 2 Mar 2012
x = 0:0.1:10;
y = exp(x);
p = polyfit(x,y,2);
x_extrapolated = 10.1:0.1:20;
y_extrapolated = polyval(p,x);
help polyfit
help polyval

Community Treasure Hunt

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

Start Hunting!

Translated by