我有一个由以下传递函数描述的低通滤波器:
h[n] = (w_c/Pi) * sinc( n * w_c / Pi ),其中 w_c 是截止频率
我必须将此低通滤波器转换为带通滤波器。
我有一个由以下传递函数描述的低通滤波器:
h[n] = (w_c/Pi) * sinc( n * w_c / Pi ),其中 w_c 是截止频率
我必须将此低通滤波器转换为带通滤波器。
您h[n]
转换到rect
频域中。要使其带通,您需要将其中心频率移得更高。
要做到这一点,乘以h[n]
,exp(j*w_offset*n)
其中w_offset
是移位量。如果w_offset
是正数,那么你会转向更高的频率。
时域中的乘法是频域中的卷积。由于exp(j*w_offset*n)
变成以 为中心的脉冲函数w_offset
,因此乘法移动H(w)
了w_offset
。
有关详细信息,请参阅离散时间傅里叶变换。
注意:这样的过滤器不会关于 0 对称,这意味着它将具有复数值。为了使其对称,您需要添加h[n]
乘以exp(-j*w_offset*n)
:
h_bandpass[n] = h[n](exp(j*w_offset*n)+exp(-j*w_offset*n))
因为cos(w*n) = (exp(j*w*n)+exp(-j*w*n))/2
我们得到:
h_bandpass[n] = h[n]cos(w_offset*n)
然后,该过滤器具有纯实值。
简短的回答是,您将乘以时域中的复指数。时域中的乘法将在频域中移动信号。
Matlab代码:
n_taps = 100;
n = 1:n_taps;
h = ( w_c / Pi ) * sinc( ( n - n_taps / 2) * w_c / Pi ) .* ...
exp( i * w_offset * ( n - n_taps / 2) );
ps 我恰好在几周前刚刚为学校实现了这个确切的功能。
这是使用窗口方法创建自己的带通滤波器的代码:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function: Create bandpass filter using windowing method
% Purpose: Simple method for creating filter taps ( useful when more elaborate
% filter design libraries are not available )
%
% @author Trevor B. Smith, 24MAR2009
%
% @param n_taps How many taps are in your output filter
% @param omega_p1 The lower cutoff frequency for your passband filter
% @param omega_p2 The upper cutoff frequency for your passband filter
% @return h_bpf_hammingWindow The filter coefficients for your passband filter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function h_bpf_hammingWindow = BPF_hammingWindow(n_taps,omega_p1,omega_p2)
% Error checking
if( ( omega_p2 == omega_p1 ) || ( omega_p2 < omega_p1 ) || ( n_taps < 10 ) )
str = 'ERROR - h_bpf_hammingWindow(): Incorrect input parameters'
h_bpf_hammingWindow = -1;
return;
end
% Compute constants from function parameters
length = n_taps - 1; % How many units of T ( i.e. how many units of T, sampling period, in the continuous time. )
passbandLength = omega_p2 - omega_p1;
passbandCenter = ( omega_p2 + omega_p1 ) / 2;
omega_c = passbandLength / 2; % LPF omega_c is half the size of the BPF passband
isHalfSample = 0;
if( mod(length,2) == 1 )
isHalfSample = 1/2;
end
% Compute hamming window
window_hamming = hamming(n_taps);
% Compute time domain samples
n = transpose(-ceil(length/2):floor(length/2));
h1 = sinc( (1/pi) * omega_c * ( n + isHalfSample ) ) * pi .* exp( i * passbandCenter * ( n + isHalfSample ) );
% Window the time domain samples
h2 = h1 .* window_hamming;
if 1
figure; stem(h2); figure; freqz(h2);
end
% Return filter coefficients
h_bpf_hammingWindow = h2;
end % function BPF_hammingWindow()
如何使用此功能的示例:
h_bpf_hammingWindow = BPF_hammingWindow( 36, pi/4, 3*pi/4 );
freqz(h_bpf_hammingWindow); % View the frequency domain
让f[n]
您从低通滤波器获得的信号w_c
位于所需频带的下限。f[n]
您可以通过从原始信号中减去来获得高于此下限的频率。这是您想要用于第二个低通滤波器的输入。