![](https://csdnimg.cn/release/download_crawler_static/86536990/bg1.jpg)
xk=[0.9,1.3,1.9,2.1,2.6,3.0,3.9,4.4,4.7,5.0,6.0,7.0,8.0,9.2,10.5,11.3,11.6,12.0,12.6,13.0,13.3];
y=[1.3,1.5,1.85,2.1,2.6,2.7,2.4,2.15,2.05,2.1,2.25,2.3,2.25,1.95,1.4,0.9,0.7,0.6,0.5,0.4,0.25];
i=(1:20);
h(i)=xk(i+1)-xk(i);
f1(i)=(y(i+1)-y(i))./h(i);
i=(2:20);
lambda(i-1)=h(i)./(h(i-1)+h(i));
mu(i)=h(i-1)./(h(i-1)+h(i));
i=(2:20);
e(i)=3*(lambda(i-1).*f1(i-1)+mu(i).*f1(i));
e(1)=3*f1(1);
e(21)=3*f1(20);
lambda(20)=1;
mu(1)=1;
A=2*eye(21)+diag(lambda,-1)+diag(mu,1);
e=e';
m=inv(A)*e;
m=m';
fprintf('各个节点处的一阶导数 m 为');
disp(m);
syms t;
for k=1:(length(xk)-1) x=xk(k);
(xk(k+1)-xk(k))/50:xk(k+1);
hold on
plot(xk,y,xk,y,':ro','MarkerSize',8);xlabel('x 轴');ylabel('y 轴');title('飞鸟外形上部三次插值曲线');
End