Create a fitting of a curve knowing points and tangents
12 views (last 30 days)
Emanuele Sortino on 31 Jan 2017
Hi all, I have a power curve where all the points create a curve. I calculated the tangent for both lines and i know the point where they start and end.
I was wondering if there was a method which knowing these information i can create a curve similar at the black line, that can become my model. How I do it in a semilog scale? thanks
John D'Errico on 13 Feb 2017
Simplest is to use my SLM toolbox . I'd break it into two separate models, one for the left half, one for the right half.
Just form the log10 of the y data (the dependent variable.) Then fit log10(Y) as a function of x. When you want to predict any values, do a prediction, which gives you predicted values as ylog=log10(y), then form 10^ylog to get numbers in the original domain.
Since you know the point where the two curves join, as well as the slope (in the log domain) you can specify the break point between the curves as a known value, as well as the end point slopes at that location. I cannot do it for you as an example, since I lack your data to show you.
The final plot is easy, since you will compute the predicted values on the curve, then use semilogy to do the plotting.
A spline model is GREAT to use for prediction, for generating plots, etc. But of course, if your goal is to have a model you can write down on paper, since SLM is a spline model, it will not be useful, but then neither will any other spline model such as an interpolating spline. In that case, you would need to use other modeling tools, that will be considerably less easy to use and fit.
More Answers (1)
Pitambar Dayal on 13 Feb 2017
Edited: Pitambar Dayal on 13 Feb 2017
I understand you want to create a curve similar to the black line using the information you already have (points on black line and tangent line).
You can create a curve by interpolating the points you already have using "interp1". The link below contains the syntax for this function as well as some examples.
To create a semilog plot, you can use the functions "semilogx" or "semilogy" based on your use case. Here is a link for "semilogy", which also contains an example.