What code to automatically put the cubic splines in a plot?
3 views (last 30 days)
Show older comments
Say you have:
x = -10:2:10 y = sin(x)
plot(x,y,'o')
Instead of having to click the Figure Tools then clicking the cubic splines,
is there a code that will automatically activate that?
Also, how would you fill with a colour the area between the splines and the x-axis?
Cheers
0 Comments
Answers (1)
Paul Premakumar
on 27 Mar 2013
Why not use the SPLINE command
plot(x,y)
figure
xx = -10:.25:10;
yy = spline(x,y,xx);
%plot(xx,yy); % display your data
% Use area to fill the are under the curve
area(xx,yy);
0 Comments
See Also
Categories
Find more on Splines in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!