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

3 Ansichten (letzte 30 Tage)
Dominic
Dominic am 27 Mär. 2013
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

Antworten (1)

Paul Premakumar
Paul Premakumar am 27 Mär. 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);

Kategorien

Mehr zu Splines finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by