cubic spline function
6 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am having trouble using the Cubic Spline function.
I have to find the max value for y and what it corrospondes to in x. The data that has been given is
x = [0.6,0.7,0,8,0,9,1.0,1.1,1.2,1.3,1.4]';
y = [107,110,112,113.5,114,112,109,104,97]';
I have then used the follow code becuase I want to know the maximun y and what it corrospondes to x
yi = interp1(x, y,0.6:0.01:1.4,'spline')'
Now looking though the variable editor screen in Matlab I can see that 114.0904 is the max value but I am not sure how to extract this using matlab. The code I have been using is below.
x = [0.6,0.7,0,8,0,9,1.0,1.1,1.2,1.3,1.4]';
y = [107,110,112,113.5,114,112,109,104,97]';
yi = interp1(x, y,0.6:0.01:1.4,'spline')'
y1=(0.6:0.01:1.4)';
ans = max(yi)
Now this gives me the answer 114.0904 but now I am not sure for what value of x this is?
Any help would be appriciated
Thanks
0 件のコメント
回答 (1 件)
Andrei Bobrov
2011 年 9 月 18 日
use functions from Curve Fitting Toolbox
x = [0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4]';
y = [107,110,112,113.5,114,112,109,104,97]';
pp = interp1(x,y,'spline','pp');
dpp = fnder(pp);
maxy = fnval(pp,fzero(@(k)fnval(dpp,k),mean(x)));
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spline Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!