Fit points and specify the slope at one of the points
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Splines에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!