1. 程式人生 > >用matlab程式實現求解三次樣條插值

用matlab程式實現求解三次樣條插值

X =[ 0,0.2,0.4,0.6,0.8,1.0];
Y=[1.0, 0.818732, 0.670320, 0.548812, 0.449329, 0.367879];
cs = csapi(X,Y);   %三次樣條函式
fnplt(cs);
hold on
plot(X,Y,'o')
legend('cubic spline','data')
hold off