cubic_spline_natural

3 次查看(过去 30 天)
BUTHOLEZWE MBANGENI
回答: David Ding 2017-9-27
x = [2 2.5 3 4 5 6.5 8]; y = [3 -1 3 -4 0 3 2]; Given this data use cubic_spline_natural function to construct and plot a free cubic spline with zero second derivative at two ends I tried this code below but I keep getting
xx= linspace(2,8); m = length(xx); yy=zeros(1,m); for i = 1:m; yy(i)= cubic_spline_natural(x,y,0.0,0.0,xx(i)); end Undefined function or variable 'cubic_spline_natural'. variable 'cubic_spline_natural'.
xx= linspace(2,8); m = length(xx); yy=zeros(1,m); for i = 1:m; yy(i)= cubic_spline_natural(x,y,0.0,0.0,xx(i)); end Undefined function or variable 'cubic_spline_natural'.
yyy(i)= cubic_spline_natural(x,y,0.0,0.0,xx(i)); Undefined function or variable 'cubic_spline_natural'.

回答(1 个)

David Ding
David Ding 2017-9-27
Do:
>> which cubic_spline_natural
If the output is:
'cubic_spline_natural' not found.
Then likely you did not define this function in the first place. If this is the case, you need to write this function as it is not a MATLAB built-in function.
However, if you did, make sure that it resides in the current working directory or add the directory containing this function in your working path.
Thanks,
David

类别

Help CenterFile Exchange 中查找有关 Splines 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by