1、随机抽取8个点,进行绘图。n = 8;x = rand(n,1);y = rand(n,1);p盟敢势袂lot(x,y,'.')axis([0 1 0 1])
2、按“Enter”键。如图1所示。
3、用两条样条曲线插值点,用较细的间距计算。用红线标出插值曲线。t = 1:n;ts 屏顿幂垂= 1:1/10:n;xs = splin髫潋啜缅e(t,x,ts);ys = spline(t,y,ts);hold onplot(xs,ys,'r');hold off
4、按“Enter”键。如图2所示。