?? hc325.m
字號:
%《數字信號處理教程——MATLAB釋義與實現(xiàn)》第三章例3.2.5程序hc325
% 序列信號DTFT的對稱性和時移性
% 電子工業(yè)出版社出版 陳懷琛編著 2004年9月
%
x=[1,3,5,3,1];nx=[-1:3];
w=linspace(-8,8,1000); % 設定頻率向量
X=x*exp(-j*nx'*w); % 用(3.2.1a)式計算DTFT
subplot(5,3,1),stem(nx,x,'.'),axis([-2,6,-1,6]) % 畫序列圖
title('原始序列')
ylabel('x(n)')
subplot(5,3,4),plot(w,abs(X)), % 畫幅頻相頻曲線
ylabel('幅度')
subplot(5,3,7),plot(w,angle(X))
ylabel('相角')
subplot(5,3,10),plot(w,real(X)), % 畫實頻虛頻曲線
ylabel('實部')
subplot(5,3,13),plot(w,imag(X))
ylabel('虛部')
nx1=nx+2; X1=x*exp(-j*nx1'*w); % 使x右移兩位后,計算其DTFT
subplot(5,3,2),stem(nx1,x,'.'),axis([-2,6,-1,6])
title('右移兩位')
subplot(5,3,5),plot(w,abs(X1)), subplot(5,3,8),plot(w,angle(X1))
subplot(5,3,11),plot(w,real(X1)), subplot(5,3,14),plot(w,imag(X1))
nx2=nx-1; X2=x*exp(-j*nx2'*w); % 使x左移一位后,計算其DTFT
subplot(5,3,3),stem(nx2,x,'.'),axis([-2,6,-1,6])
title('左移一位')
subplot(5,3,6),plot(w,abs(X2)), subplot(5,3,9),plot(w,angle(X2))
subplot(5,3,12),plot(w,real(X2)), subplot(5,3,15),plot(w,imag(X2))
set(gcf,'color','w') % 置圖形背景色為白
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -