📄 program_03_01.m
字号:
% Program 3_1
% Discrete-Time Fourier Transform Computation
%
% Read in the desired length of DFT
colordef black;
k = input('Number of frequency points = ');
% Read in the numerator and denominator coefficients
num = input('Numerator coefficients = ');
den = input('Denominator coefficients = ');
% Compute the frequency response
w = 0:pi/k:pi;
h = freqz(num, den, w);
% Plot the frequency response
subplot(2,2,1)
plot(w/pi,real(h),'g');grid
title('Real part')
xlabel('\omega/\pi'); ylabel('Amplitude')
subplot(2,2,2)
plot(w/pi,imag(h),'g');grid
title('Imaginary part')
xlabel('\omega/\pi'); ylabel('Amplitude')
subplot(2,2,3)
plot(w/pi,abs(h),'g');grid
title('Magnitude Spectrum')
xlabel('\omega/\pi'); ylabel('Magnitude')
subplot(2,2,4)
plot(w/pi,angle(h),'g');grid
title('Phase Spectrum')
xlabel('\omega/\pi'); ylabel('Phase, radians')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -