Enforcing a particular curve to fit the data points
1 view (last 30 days)
Show older comments
Hi, I am trying to fit some data points so that the trend is first any polynomial function and then it becomes a plateau. In the figure below I am ok with the first part of the fitting but I am trying to get a plateau approximately from the crossed symbol to the end. Of course the point from where the curve will be a plateau needs to be determined by the function and not by me.
So far I tried the code below to fit:
figure
ft = fittype('f*x^5+e*x^4+d*x^3+b*x^2+c*x+a');
SS = fit(CMOD(1:end-1)',dEpsilonDtMean(1:end,1),ft,'StartPoint',[0,0,0,0,0,0],'Robust','Bisquare')
plot(SS,CMOD(1:end-1),dEpsilonDtMean(1:end,1))
3 Comments
the cyclist
on 6 May 2021
The first step is to define -- just in words, not in code -- where the plateau begins.
I understand that you want the MATLAB code to figure out where the plateau begins; but code cannot figure it out if you cannot describe it.
So, when I look at the data -- how do I know I have reached the plateau region?
Also, just out of curiosity, why do you think a polynomial is the appropriate choice in the pre-plateau region? Why not, say, an oscillatory function that damps out exponentially?
Answers (1)
Image Analyst
on 5 May 2021
Edited: Image Analyst
on 5 May 2021
What if you just made the y values constant after the x value of 0.6
index = find(x >= 0.06, 1, 'first');
CMOD(index:end) = 0.5; % Or whatever value you want the plateau to have.
plot(x, CMOD, 'b-')
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!