spline
This commit is contained in:
15
samples/spline.m
Normal file
15
samples/spline.m
Normal 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')
|
||||
Reference in New Issue
Block a user