Enforcing a particular curve to fit the data points
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
the cyclist
2021-5-6
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?
回答(1 个)
Image Analyst
2021-5-5
编辑:Image Analyst
2021-5-5
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-')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!