📄 p2_a4.m
字号:
% Program P2_A4
% Evaluation of the DTFT
close all ; clear all;
% Compute the frequency samples of the DTFT
w = -4*pi:8*pi/511:4*pi;
num = [1 3 5 7 9 11 13 15 17];
h = freqz(num, 1, w);
% Plot the DTFT
subplot(2,1,1);plot(w/pi,real(h));grid;title('Real part of H(e^{j\omega})')
xlabel('\omega /\pi');ylabel('Amplitude');
subplot(2,1,2);plot(w/pi,imag(h));grid;title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');ylabel('Amplitude');
figure
subplot(2,1,1);plot(w/pi,abs(h));grid;title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega /\pi');ylabel('Amplitude');
subplot(2,1,2);plot(w/pi,angle(h));grid;title('Phase Spectrum arg[H(e^{j\omega})]')
xlabel('\omega /\pi');ylabel('Phase in radians');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -