📄 p2_g.m
字号:
% Program P2_G.m
% Evaluation of the DFT
close all ; clear all;
% 7-length sequence
n=[-3:3];
x=cos(pi*n/6);
% Compute the M-point DFT
M=8;
X=fft(x,M);
% Plot the original sequence
figure(1)
t=-3:1:3;
stem(t,x);grid
xlabel('Time index n');ylabel('Magnitude')
title('Original time-domain sequence')
% Plot the magnitude and phase of the DFT
figure(2)
subplot(2,1,1)
k=0:1:M-1;
stem(k,abs(X));grid
xlabel('Frequency index k');ylabel('Magnitude')
title('The magnitude of the DFT')
subplot(2,1,2)
stem(k,angle(X));grid
xlabel('Frequency index k');ylabel('Phase')
title('The phase of the DFT')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -