Fit points and specify the slope at one of the points
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
Réponses (1)
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
0 commentaires
Voir également
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!