• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Exponential Regression

Stiganator

Platinum Member
I have a data set that can be fitted pretty well with a linear fit. However I would like to do an exponential fit to see if that would also cover the range I haven't yet sampled (it looks to be tapering towards the extremes so I'll have to widen the range)

If I take the natural log of the data and then fit a linear curve the exponential coefficients will be

linear fit of ln(X) vs Y is y=ax+b


exponential equivalent is y = e^a*e^x + e^b or y= e^ax+e^b

Is that right? I don't know why this is eluding me since it is pretty basic.

Any quick way to do this with Matlab? I know there is a polyfit function, but help didn't pop up anything on exponential fits.
 
Simple to do in MATLAB.

%input the data as x= and y=
%after data is loaded,
logy=log(y);
params=[1,1];%initial parameter estimates
[params,SSR]=fminunc(@(params) FitExponentials(x,y,logy),params);

[SSR,yhat]=FitExponential(x,y,logy)

function [SSR,yhat]=FitExponential(x,y,logy)
yhat=params(1)*exp(params(2)*x);
logyhat=log(yhat);
SSR=sum((logy-logyhat).^2);
end

edit: added a re-run of the function so you get the fitted values (yhat).
 
Another software program that's very simple to use and fit all sorts of curves is graphical analysis. It's sold by Vernier. They have a free demo (which, IIRC, is the complete version that expires after one month.) Google search for it... my wife just beeped her horn or I would.
 
Back
Top