?? dtft_beike.m
字號:
%==========================================================================
% Name:DTFT.m
% The program compute the DTFT of discrete-time sequence x(n),
% and plot the curves.
%==========================================================================
clear;
n=-5:5;
x1=0.5.^n.*u(n);
x2=0.5.^(-n).*u(-n);
x3=(x1+x2)/2;
x4=(x1-x2)/2;
W1=2*pi;
N=512;
k=-N:N;
W=k*W1/(N);
figure(1)
F1=x1*exp(-j*n'*W);
F1_1=abs(F1);
phi=57.3*angle(F1);
subplot(3,1,1);stem(n,x1,'.');grid on;
ylabel('the curve of x(n)');
title('The DTFT of the sequence x(n)');
subplot(3,1,2);plot(W,F1_1);grid on;
xlabel('w');
ylabel('The magnitude spectra ');
subplot(3,1,3);
plot(W,phi,'r');grid on;
xlabel('w');ylabel('The phase spectra');
figure(2)
F2=x3*exp(-j*n'*W);
F2_2=real(F2);
phi=57.3*angle(F2);
subplot(3,1,1);stem(n,x3,'.');grid on;
ylabel('the curve of x(n)');
title('The DTFT of the sequence x(n)');
subplot(3,1,2);plot(W,F2);grid on;
xlabel('w');
ylabel('The magnitude spectra ');
subplot(3,1,3);
plot(W,phi,'r');grid on;
xlabel('w');ylabel('The phase spectra');
figure(3)
F3=x4*exp(-j*n'*W);
F3_3=imag(F3);
phi=57.3*angle(F3);
subplot(3,1,1);stem(n,x4,'.');grid on;
ylabel('the curve of x(n)');
title('The DTFT of the sequence x(n)');
subplot(3,1,2);plot(W,F3_3);grid on;
xlabel('w');
ylabel('The magnitude spectra ');
subplot(3,1,3);
plot(W,phi,'r');grid on;
xlabel('w');ylabel('The phase spectra');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -