What code to automatically put the cubic splines in a plot?
3 次查看(过去 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
0 个评论
回答(1 个)
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);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Splines 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!