?? example5_4.m
字號:
%==========================================================================
% Name:example5_4.m
% The program compute the DTFT of discrete-time sequence x(n),
% and plot the curves.
%==========================================================================
clear;close all;
n=-20:20;
x=input('Type in the time sequence x[n]=');%u(n)-u(n-1);
w1=2*pi;N=512;k=-N:N;
dw=w1/N;
w=k*w1/(N);
X=x*exp(-j*n'*w); % Compute the Fourier transform of x[n]
X1=abs(X);
phi=57.3*angle(X);
k=input('Type in the scale k=');
X2=X.*(u(w+pi*k)-u(w-pi*k));
x1=X2*dw*exp(j*w'*n)/(2*pi); % Compute the inverse Fourier transform
subplot(221);stem(n,x,'.');
grid on;
title('The sequence x[n]');
axis([-20,20,-0.2,1.2])
subplot(222);plot(w/(pi),X1);grid on;
title('The DTFT of sequence x[n]');
axis([-2,2,-0.2,1.2])
subplot(223);stem(n,x1,'.');
xlabel('Index n');grid on;
axis([-20,20,-0.2,1.2])
subplot(224);
plot(w/(pi),abs(X2),'r');grid on;
xlabel('w[*pi]');
axis([-2,2,-0.2,1.2])
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -