cubic spline function
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Andrei Bobrov
am 18 Sep. 2011
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 Kommentare
Siehe auch
Kategorien
Mehr zu Spline Postprocessing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!