Enforcing a particular curve to fit the data points

4 vues (au cours des 30 derniers jours)
Mohammod Minhajur Rahman
Mohammod Minhajur Rahman le 5 Mai 2021
Commenté : the cyclist le 6 Mai 2021
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 commentaires
Mohammod Minhajur Rahman
Mohammod Minhajur Rahman le 5 Mai 2021
The blue dots are raw data that ideally should have a plateau beyond 0.06 (just eye estimation), but it can never be achived practically, so I need to find the point from where the polynomial curve becomes a plateau. From the beginning, the first portion of these data should be fitted by a polynomial (not necessarily 5th order) and there should be a point (let's say 0.06) beyond which it should be a plateau. Basically, I need to find the point where the derivative of the fitting function becomes zero, and beyond that I can enforce a plateau manually. Of course I can not pick that point on eye estimation.
the cyclist
the cyclist le 6 Mai 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?

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 5 Mai 2021
Modifié(e) : Image Analyst le 5 Mai 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-')
  1 commentaire
Mohammod Minhajur Rahman
Mohammod Minhajur Rahman le 5 Mai 2021
Sorry, my bad, I edited the post now: Of course the point from where the curve will be a plateau needs to be determined by the function and not by me. So, bascically I am trying to find the point where the derivative of the polynomial will be zero for the first time, and beyond that point I can make all the y values similar to have a plateau till end.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by