This commit is contained in:
2014-11-26 16:48:23 +01:00
parent aa5fda0dfd
commit a154133af8

15
samples/spline.m Normal file
View File

@@ -0,0 +1,15 @@
x=[-2 0 2 3 4 5];
y=[4 0 -4 -30 -40 -30];
plot(x,y,'sr')
hold on
p=polyfit(x,y,5)
p =
-0.2286 2.5333 -6.2286 -10.1333 26.5714 0.0000
xx=-2:0.1:5;
yy=polyval(p,xx);
plot(xx,yy,'b')
ys=spline(x,y,xx);
plot(xx,ys,'g')