x0=1:60;
y0=[21.9,19.8,18.25,17,14.3,18,15.9,13.78,8.89,10.99,11.51,16.2,11.5,11.26,11.17,10.68,10.4,10.44,10.8,10.73,10.04,12.05,9.64,9.0,9.11,10.2,9.71,7.75,7.48,7.2,6.77,6.26,6.12,7.59,7.88,10.431,15.842,13.025,15.802,15.93,17.17,16.28,15.18,16.68,18.29,19.08,16.87,17.49,19.3,24.4,27.55,44.69,33.64,36.13,34.87,30.51,22.55,21.12,25.07,25.66];
x=x0;
y=y0;
n=length(y);
s=cell(1,n-1);
t=cell(1,n-1);
for i=1:n-1
s{i}=x;
t{i}=y;
end
hold on
plot(x,y,'*b')
plot(x,y,'-b')
%变换参数
xl=x(n)-x(1);
yl=y(n)-y(1);
d=0.1*ones(1*60);
a=(x(2:n)-x(1:n-1))/xl;
c=(y(2:n)-y(1:n-1))/xl-d(2:n)*(yl/xl);
e=(x(n)*x(1:n-1)-x(1)*x(2:n))/xl;
f=(x(n)*y(1:n-1)-x(1)*y(2:n))/xl-d(2:n)*((x(n)*y(1)-x(1)*y(n))/xl);
for k=1:20
for i=1:n-1
s{i}=a(i)*s{i}+e(i);
t{i}=c(i)*s{i}+d(i)*t{i}+f(i);
end
end
for i=1:n-1
stem(s{i},t{i},'+r')
end
用这种方法插值为什么点这么少啊?? |