Fit points and specify the slope at one of the points

3 vues (au cours des 30 derniers jours)
Daria Nikitaeva
Daria Nikitaeva le 9 Fév 2021
Commenté : darova le 10 Fév 2021
Hello,
I have a series of 4 points:
x=[-0.385444 0 0.985035 4.36849];
y=[0.599583870363438 0.103 1.00644809697272 2.02362891855202];
At x=0.985035, I need the slope to be 0.
How do I do this?
I am familiar with the spline function, but it will only let me specify the slope at the begining and end of the curve.
Thank you.
  1 commentaire
darova
darova le 10 Fév 2021
Can you make a drawing of ho the curve should look like

Connectez-vous pour commenter.

Réponses (1)

Alex Sha
Alex Sha le 10 Fév 2021
Hi, try the function below:
y = p1+p2*x^2-p3*exp(p4*x);
to ensure the slope being 0 in point of "x=0.985035", should add a constraint of "p2*(2*xx)-p3*(exp(p4*xx)*p4)=0", where xx=0.985035. The result will be:
Root of Mean Square Error (RMSE): 0.287966090994206
Sum of Squared Residual: 0.331697878249934
Correlation Coef. (R): 0.913088032059037
R-Square: 0.833729754289445
Constrained Functions: p2*1.97007-p3*(exp(p4*0.985035)*p4)-0 = 1.44750877950628E-11
Parameter Best Estimate
---------- -------------
p1 -0.154217819730129
p2 -0.391394281530186
p3 -0.727826672642068
p4 0.591562409273376

Catégories

En savoir plus sur Splines dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by