Logarithmic, Power, and Exponential Fit

12 views (last 30 days)
M Cham
M Cham on 15 Oct 2014
Edited: M Cham on 19 Oct 2014
I am trying to find the slope and intercept values for a Logarithmic, Power, and Exponential fit for my X and Y data series. I am looking for the r^2 value as well. This is the code I used in 2013, which isn't working for me anymore:
[sl,in]=logfit(x,y,'logx') %log fit
[sl,in]=logfit(x,y,'loglog') %power fit
[sl,in]=logfit(x,y,'logy') %exponential fit
The command window says it does not recognize the 'logfit' command, then asks if I meant 'lognfit'. When I change the command to 'lognfit' the output says "X and CENSORING must have the same size."
Any advice?? I have the student version of Matlab.

Accepted Answer

Geoff Hayes
Geoff Hayes on 15 Oct 2014
logfit doesn't appear to be a MATLAB function (from either the base version or the Statistics Toolbox) so you may be referring to Jonathan C. Lansey's FEX submission which has the same function signature as what you have shown above. Download the logfit function from Power Law, Exponential and Logarithmic Fit, add the file to a folder within your MATLAB search path, and try running the above statements again.
  1 Comment
M Cham
M Cham on 19 Oct 2014
Edited: M Cham on 19 Oct 2014
That was it, thank you so much for your help!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!