ex050600.m

来自「Matlab 6.0图形图像处理所附带的光盘」· M 代码 · 共 69 行

M
69
字号
% Chapter 05: Example 05.06: Simple DFT Example%x = [1,1,1,1];subplot(1,1,1);%% a) DTFTw = [0:1:500]*2*pi/500;[H] = freqz(x,1,w);magH = abs(H); phaH = angle(H); phaH(126)=-47.5841*pi/180;subplot(2,1,1); plot(w/pi,magH); gridxlabel('frequency in pi units');ylabel('|X|'); title('Magnitude of the DTFT')subplot(2,1,2); plot(w/pi,phaH/pi*180); gridxlabel('frequency in pi units');ylabel('Degrees'); title('Angle of the DTFT')%print -deps2 me0506a.epspause;subplot(1,1,1)%% b) 4-point DFTN = 4; w1 = 2*pi/N; k = 0:N-1;X = dft(x,N);magX = abs(X), phaX = angle(X)*180/pisubplot(2,1,1);plot(w*N/(2*pi),magH,'--'); axis([-0.1,4.1,-1,5]); hold onstem(k,magX);xlabel('k');ylabel('|X(k)|'); title('Magnitude of the DFT: N=4')hold offsubplot(2,1,2);plot(w*N/(2*pi),phaH*180/pi,'--');axis([-0.1,4.1,-200,200]); hold onstem(k,phaX);xlabel('k');ylabel('Degrees'); title('Angle of the DFT: N=4')%print -deps2 me0506b.eps

⌨️ 快捷键说明

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