⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interp_sin_1.m

📁 自己编写的正弦插值算法及误差计算Matlab仿真试验代码
💻 M
字号:
%正弦插值
clear;
N=16
n=linspace(0,2*pi,17);
n=n(1:16);
xn=sin(n);

plot(n,xn);
k=[0:1:15];

 det_0=sin(pi*(0.5-k))./(pi*(0.5-k));
 det_1=sin(pi*(1+0.5-k))./(pi*(1+0.5-k));
 det_2=sin(pi*(2+0.5-k))./(pi*(2+0.5-k));
 det_3=sin(pi*(3+0.5-k))./(pi*(3+0.5-k));
 det_4=sin(pi*(4+0.5-k))./(pi*(4+0.5-k));
 det_5=sin(pi*(5+0.5-k))./(pi*(5+0.5-k));
 det_6=sin(pi*(6+0.5-k))./(pi*(6+0.5-k));
 det_7=sin(pi*(7+0.5-k))./(pi*(7+0.5-k));
 det_8=sin(pi*(8+0.5-k))./(pi*(8+0.5-k));
 det_9=sin(pi*(9+0.5-k))./(pi*(9+0.5-k));
 det_10=sin(pi*(10+0.5-k))./(pi*(10+0.5-k));
 det_11=sin(pi*(11+0.5-k))./(pi*(11+0.5-k));
 det_12=sin(pi*(12+0.5-k))./(pi*(12+0.5-k));
 det_13=sin(pi*(13+0.5-k))./(pi*(13+0.5-k));
 det_14=sin(pi*(14+0.5-k))./(pi*(14+0.5-k));
 det_15=sin(pi*(15+0.5-k))./(pi*(15+0.5-k));

              
               
c0=xn*det_0';

c1=xn*det_1';
c2=xn*det_2';
c3=xn*det_3';
c4=xn*det_4';
c5=xn*det_5';
c6=xn*det_6';
c7=xn*det_7';
c8=xn*det_8';
c9=xn*det_9';
c10=xn*det_10';
c11=xn*det_11';
c12=xn*det_12';
c13=xn*det_13';
c14=xn*det_14';
c15=xn*det_15';

cm=[c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15];
c=ones(1,32);
c(1:2:31)=xn;
c(2:2:32)=cm;
nn=linspace(0,2*pi,33);
nn=nn(1:32);
xnn=sin(nn);
%nn=[0:0.1963:6.2];

plot(n,xn+0.1,nn,xnn,nn,c-0.1);
y=xnn-c;
Ey=sum(y)/32;
yy=y.^2;
Eyy=sum(yy)/32;
Dy=Eyy-Ey.^2;
Dy=sqrt(Dy);%均方差



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -