dfs_beike.m

来自「经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助」· M 代码 · 共 21 行

M
21
字号
clear
n=-10:15;N=8;
x=u(n)-u(n-4);
x1=u(n+8)-u(n+4)+x+u(n-8)-u(n-12);
subplot(221)
stem(n,x,'.'),title('The principle of a periodic sequence')
axis([-10,15,0,1.1])
xlabel('Index n')
subplot(222)
stem(n,x1,'r.'),title('The periodic sequence')
axis([-10,15,0,1.1])
xlabel('Index n')
k=-20:20;
w1=2*pi/N;
w=k*w1;
F=x*exp(-j*n'*w);
subplot(212)
stem(w/w1,abs(F),'r.'),title('The DFS of the periodic sequence')
axis([-15,15,0,4.4])
xlabel('Index k')
%ylabel('The amplitude spectrum')

⌨️ 快捷键说明

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