Fit points and specify the slope at one of the points

3 ビュー (過去 30 日間)
Dennis Nikitaev
Dennis Nikitaev 2021 年 2 月 9 日
コメント済み: darova 2021 年 2 月 10 日
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 件のコメント
darova
darova 2021 年 2 月 10 日
Can you make a drawing of ho the curve should look like

サインインしてコメントする。

回答 (1 件)

Alex Sha
Alex Sha 2021 年 2 月 10 日
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

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by