我有一个由下面的传递函数描述的低通滤波器:
hn = ( w_c / Pi ) * w_c (n*w_c/Pi ),其中w_c是截止频率
我必须把这个低通滤波器转换成带通滤波器。
发布于 2009-05-04 17:39:54
您可以在频域中将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。
有关更多详细信息,请参阅Discrete Time Fourier Transform。
注意:这样的过滤器将不是关于0的对称的,这意味着它将具有复数值。要使其对称,需要添加乘以exp(-j*w_offset*n)的h[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)
然后,此过滤器具有纯实数的值。
发布于 2009-05-06 12:25:00
简短的答案是,你将在时域中乘以一个复数指数。时域中的乘法将使信号在频域中移位。
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) );附注:几周前,我恰好为学校实现了这个功能。
下面是使用窗口方法创建您自己的带通滤波器的代码:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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发布于 2009-05-04 18:45:31
假设f[n]是在所需频带的下限使用w_c的低通滤波器得到的信号。通过从原始信号中减去f[n],可以得到高于这个下限的频率。这是您希望用于第二个低通滤波器的输入。
https://stackoverflow.com/questions/820944
复制相似问题