dtft_step.m
来自「经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助」· M 代码 · 共 67 行
M
67 行
n=0:40;
w0=0*pi;
w1=0.1*pi;
w2=0.2*pi;
w3=0.8*pi;
w4=0.9*pi;
w5=1*pi;
w6=1.1*pi;
w7=1.2*pi;
x0=cos(w0*n);
x1=cos(w1*n);
x2=cos(w2*n);
x3=cos(w3*n);
x4=cos(w4*n);
x5=cos(w5*n);
x6=cos(w6*n);
x7=cos(w7*n);
subplot(421)
stem(n,x0,'k.'),axis([0,30,-1.2,1.2])
title('w0=0')
subplot(422)
stem(n,x1,'k.'),
axis([0,30,-1.2,1.2])
title('w0=0.1pi')
subplot(423)
stem(n,x2,'k.'),axis([0,30,-1.2,1.2])
hold on,t=0:0.01:40;x2=cos(w2*t);plot(t,x2,'r:'),
ylabel('w0=0.2pi')
subplot(424)
stem(n,x3,'k.'),axis([0,30,-1.2,1.2])
hold on,t=0:0.01:40;x3=cos(w3*t);plot(t,x3,'r:'),
ylabel('w0=0.8pi')
subplot(425)
stem(n,x4,'k.'),axis([0,30,-1.2,1.2])
hold on,t=0:0.01:40;x4=cos(w4*t);plot(t,x4,'r:'),
ylabel('w0=0.9pi')
subplot(426)
stem(n,x5,'k.'),axis([0,30,-1.2,1.2])
hold on,t=0:0.01:40;x5=cos(w5*t);plot(t,x5,'r:'),
ylabel('w0=pi')
subplot(427)
stem(n,x6,'k.'),axis([0,30,-1.2,1.2])
hold on,t=0:0.01:40;x6=cos(w4*t);plot(t,x6,'r:'),
ylabel('w0=1.1pi')
subplot(428)
stem(n,x7,'k.'),axis([0,30,-1.2,1.2])
hold on,t=0:0.01:40;x7=cos(w3*t);plot(t,x7,'r:'),
ylabel('w0=1.2pi')
figure(2)
%subplot(211)
x7=cos(w7*n);
stem(n,x7,'k.'),axis([0,10,-1.2,1.2])
hold on,t=0:0.01:40;x8=cos(w3*t);plot(t,x8,'r:'),
t=0:0.01:40;x9=cos(w7*t);plot(t,x9,'b:'),
%ylabel('w0=1.2pi')
legend('b:','w0=1.2pi','r:','w0=0.8pi')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?