How do I extract the exponent from a semilogy plot?

6 Ansichten (letzte 30 Tage)
Janna Hinchliff
Janna Hinchliff am 26 Feb. 2019
Kommentiert: Stephan am 26 Feb. 2019
If I use semilogy to plot some data such that the plot appears as a straight line, how can I extract the exponent of this line? Can I use polyfit to get this or is there a different way?

Akzeptierte Antwort

Stephan
Stephan am 26 Feb. 2019
Bearbeitet: Stephan am 26 Feb. 2019
Hi,
i think you should use lsqcurvefit (requires Optimization Toolbox) or fit (requires Curve Fitting Toolbox) - depending on the toolboxes you have access to. I would expect an exponential function if there is a straight line in the semilogy plot. Due to this polyfit is not the correct choice. I recommend to work through this examples:
lsqcurvefit:
fit:
In case of lsqcurvefit the resulting elements of solutiuon x contain the needed exponent. In case of fit you get the values with the coeffvalues function.Therefore see also Fit Postprocessing.
Best regards
Stephan
  4 Kommentare
Janna Hinchliff
Janna Hinchliff am 26 Feb. 2019
No worries, I sorted it - I had another variable stored as fit from a different part of the code! Thanks for your help!
Stephan
Stephan am 26 Feb. 2019
No problem - if this was useful for you please accept my answer.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by