📄 notchout.m
字号:
%b=[1,-2*cos(pi/200),1];
%a=[1,-2*(1-0.021)*cos(pi/200),1-2*0.021];
%t =0:0.01:99;
%d = 0.3*sin(pi*0.5*t);
t =0:1/400:10;
d = 0.1*cos(pi/2*t);
subplot(311)
q=length(t);
plot(t,d);
axis([0,t(q),-0.3,0.3]);
title('zhengxuan信号源曲线图');
s=d;
w0=pi*0.005;
n=zeros(1,q);
n(1)=s(1);
n(2)=s(2)-2*cos(w0)*s(1)+(1+0.95)*cos(w0)*n(1);
for i=3:1:q
n(i) = s(i)-2*cos(w0)*s(i-1)+s(i-2)+(1+0.95)*cos(w0)*n(i-1)-0.95*n(i-2);
end
%信号经陷波器后应该输出为零
out=s-n;
subplot(312)
plot(t,n,'r');
title('应该为零');
subplot(313)
plot(t,out,'k');
axis([0,t(q),-0.3,0.3]);
title('为原信号');
grid;
% n(2)=s(2)-2*cos(w0)*s(1)+2*(1-0.021)*cos(w0)*n(1);
% n(i) = s(i)-2*cos(w0)*s(i-1)+s(i-2)+2*(1-0.021)*cos(w0)*n(i-1)-(1-2*0.021)*n(i-2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -