Clear Filters
Clear Filters

cubic_spline_natural

1 view (last 30 days)
BUTHOLEZWE MBANGENI
BUTHOLEZWE MBANGENI on 19 Sep 2017
Answered: David Ding on 27 Sep 2017
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'.

Answers (1)

David Ding
David Ding on 27 Sep 2017
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

Community Treasure Hunt

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

Start Hunting!