📄 jakes_filter.m
字号:
% File: Jakes_filter.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.
%
function [impw] = jakes_filter(fd)
% FIR implementation of the Jakes filter (128 points)
n = 512; nn = 2*n; fs=100; % nn is FFT block size
f = 0:fs/64:fs; % sampling frequency = 16*fd
H = zeros(1,n); % initialize H(f)
for k=1:(n/8+1) % psd for k=1:65
jpsd(k)=[1-cos(pi*(f(k))/fs)]^2;
% if(jpsd(k))>1000
% jpsd(k)=1000;
% end
H(k)=jpsd(k)^0.5; % first 65 points of H
end
for k=1:n % generate negative frequencies
H(n+k) = H(n+1-k);
end
[inv,time] = linear_fft(H,nn,fs/64); % inverse FFT
imp = real(inv(450:577)); % middle 128 points
impw = imp.*hanning(128)'; % apply hanning window
energy = sum(impw.^2); % compute energy
impw = impw/(energy^0.5); % normalize
% End of function file.
ts = 1/(16*fs); % sampling frequency and time
time = [1*ts:ts:128*ts]; % time vector for plot
subplot(2,1,1)
stem(time,impw,'.'); grid
xlabel('Time'); ylabel('Impulse Response')
% Square the fft and check the power transfer function.
%
[h fd] = linear_fft(impw,128,ts); % generate H(f) for filter
subplot(2,1,2)
plot(fd,abs(h.*h)); grid;
xlabel('Frequency'); ylabel('PSD')
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -