?? c5_firdesign.m
字號:
% File: c5_FIRdesign.m
% Software given here is to accompany the textbook: W.H. Tranter,
% K.S. Shanmugan, T.S. Rappaport, and K.S. Kosbar, Principles of
% Communication Systems Simulation with Wireless Applications,
% Prentice Hall PTR, 2004.
%
L = 30; % 2L+1 total points
lam = 0.3; % normalized cutoff frequency
m = -L:1:L; % vector of points
bp = sin(pi*lam*(m+eps))./(pi*(m+eps)); % impulse response
stem(0:2*L,bp,'.') % plot impulse response
xlabel('Sample index')
ylabel('Impulse response')
figure; a = 1; freqz(bp,a) % plot amp and phase response
figure; subplot(2,1,1) % new figure
[H w] = freqz(bp,a);
plot(w/pi,abs(H)); grid; % unwindowed amp response
xlabel('Frequency (normalized to the Nyquist frequency = fs/2)')
ylabel('|H(f)| (unwindowed)')
subplot(2,1,2)
w = 0.54+0.46*cos(pi*m/L); % Hamming window
wbp = bp.*w; % apply window
[H w] = freqz(wbp,a);
plot(w/pi,abs(H)); grid; % windowed amp response
xlabel('Frequency (normalized to the Nyquist frequency = fs/2)')
ylabel('|H(f)| (windowed)')
% End of script file.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -