How can i find the minimum value of spline data

12 ビュー (過去 30 日間)
esat gulhan
esat gulhan 2020 年 8 月 8 日
コメント済み: Alan Stevens 2020 年 8 月 8 日
How can i find the minimum value of spline curve.
My code is below:
x=[0 0.34906585 0.698131701 1.047197551 1.396263402 1.745329252 2.094395102 2.443460953 2.792526803]
y=[0 0.342020143 0.64278761 0.866025404 0.984807753 0.984807753 0.866025404 0.64278761 0.342020143]
s=spline(x,y)
min(ppval(s))
it does not work

採用された回答

Alan Stevens
Alan Stevens 2020 年 8 月 8 日
Change your last two lines to:
s=spline(x,y);
min(ppval(s,x))
(though it's fairly clear that the minimum occurs at x = 0!)
  2 件のコメント
esat gulhan
esat gulhan 2020 年 8 月 8 日
Hi, thanks anywa but when i try min another spline data
x=[0 0.592699082 1.185398163 1.878097245 2.570796327 3.263495408 3.95619449 4.648893572 5.341592654]
y=[0 -0.55860177 -0.926648825 -0.953153478 -0.540302306 0.121601061 0.727452453 0.997984844 0.808496404]
s=spline(x,y);
min(ppval(s,x))
the answer is -0.953153478, it is wrong, it is the minimum of vector y not the minimum of spline (x,y)
The real minimum of this spline is at aproximately -0.99942679143809 at 1.5707963 it is smaller then -0.95.
So how can i find the real miniumum of spline
Alan Stevens
Alan Stevens 2020 年 8 月 8 日
You need a much finer resolution for the interpolation. Try
x=[0 0.592699082 1.185398163 1.878097245 2.570796327 3.263495408 3.95619449 4.648893572 5.341592654];
y=[0 -0.55860177 -0.926648825 -0.953153478 -0.540302306 0.121601061 0.727452453 0.997984844 0.808496404];
X = 0:0.01:max(x);
Y=spline(x,y,X);
plot(X,Y)
min(Y)

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

その他の回答 (0 件)

カテゴリ

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