What code to automatically put the cubic splines in a plot?

1 次查看(过去 30 天)
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

回答(1 个)

Paul Premakumar
Paul Premakumar 2013-3-27
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);

类别

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