?? fre_fir_win.m
字號:
%==========================================================================
% Name:fre_fir_win.m
% The program compute the DTFT of discrete-time sequence x(n),
% and plot the curves.
%==========================================================================
clear;close all;
t0=10;%input('Type in the time dely t0=');
n=-30:60;
hd=0.4*sin(0.4*pi*(n-t0+eps))./(0.4*pi*(n-t0+eps));%input('Type in the impulse response h(n)=');
Rt0=u(n)-u(n-2*t0-1);
h=hd.*Rt0;
%==================================================
% Compute the DTFT of hd(n)
%==================================================
W1=pi;
N=512;
k=-N:N;
W=k*W1/(N);
H=h*exp(-j*n'*W);
phi=57.3*angle(H);
%=================================================
subplot(221);stem(n,hd,'.');grid on;axis([min(n),max(n),1.1*min(hd),1.2*max(hd)])
title('The impulse response hd(n)');
subplot(223);
stem(n,h,'.');grid on;axis([min(n),max(n),1.1*min(h),1.2*max(h)])
xlabel('Time index n');title('The impulse response h(n)');
subplot(222);
plot(k/N,abs(H));grid on;axis([-1,1,0,1.2*max(abs(H))])
title('The magnitude response ');
subplot(224);
plot(k/N,phi,'r');grid on;
axis([-1,1,min(phi),max(phi)])
xlabel('Frequency (*pi)');title('The phase response ');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -