Fitting a natural log curve

9 views (last 30 days)
Kelsey Riley
Kelsey Riley on 26 Sep 2019
Commented: Star Strider on 26 Sep 2019
I am extremely new to MATLAB, just need it for one of my classes.
I need to take a set of data, Time vs Temp, and extract an equation from it.
This is the plot I currently have
It is fit with a linear curve, however I believe I need a natural log curve.
How do I change the fit to something other than linear or polynomial?
  1 Comment
Star Strider
Star Strider on 26 Sep 2019
It looks something like a logistic function to me.

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 26 Sep 2019
Um, a log curve does not have that shape. (Natural or not.) So trying to use a log function to fit that data will not leave you happy. It will just leave you wondering if you are doing something wrong. (And then you will ask another question, wondering what happened.)
Essentially, your curve has a toe down at the bottom (left) end of the curve. That is something a log function completely lacks. You mention a polynomial. That too will be a bad choice, since it clearly seems to be flattening out at the ends. Polynomials don't do that well.
I don't have your data to suggest a better model. Typically, since you have no idea about a good function to use, a spline model is a good choice. Although there are many varieties of curves that are sigmoidal in shape. One of them might be a good fit.
What I don't know is what you will do with any model. Do you just want a pretty plot? Do you want something you can use to interpolate the data? Do you need something with a simple functional form that you can write down for whatever purpose? What do you expect about the behavior of that curve beyond the ends of the data? All of these things would impact any advice I could give you. But for now, my only advice is to not use a log to fit your data.

Tags

Community Treasure Hunt

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

Start Hunting!