Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a low-pass filter to a band-pass filter

I have a a low pass filter described by the following transfer function:

h[n] = (w_c/Pi) * sinc( n * w_c / Pi ), where is w_c is the cutoff frequency

I have to convert this low-pass filter to a band-pass filter.

like image 268
Alceu Costa Avatar asked May 04 '09 17:05

Alceu Costa


People also ask

How do you make a band pass filter?

A simple passive Band Pass Filter can be made by cascading together a single Low Pass Filter with a High Pass Filter. The frequency range, in Hertz, between the lower and upper -3dB cut-off points of the RC combination is know as the filters “Bandwidth”.

Is bandpass a low-pass filter?

A band pass filter is a combination of a high pass and a LPF. It allows only a select range of frequencies to pass through. It is designed such a way that the cut off frequency of the LPF is higher than the cut off frequency of the high pass filter, hence allowing only a select range of the frequencies to pass through.

How is band pass filter calculated?

Band Pass Filter using R, L and C Components The centre frequency of the band pass filter which is also termed as 'resonant peak' can be formulated by using the below equation: fc = 1/2π√(LC) Where L = inductance of an inductor whose units are in Henry (H).

How can an op amp be used to create a band pass filter?

In order to realize this filter the order of the low pass and high pass circuits must be same. By cascading one first order low pass and high pass gives us the second order band pass filter and by cascading two first order low pass filters with two high pass filters forms a fourth order band pass filter.


2 Answers

You h[n] transforms into a rect in frequency domain. To make it band pass you need to move its central frequency higher.

To do this, multiply h[n] by exp(j*w_offset*n), where w_offset is the amount to shift. If w_offset is positive, then you shift towards higher frequencies.

Multiplication in time domain is convolution in frequency domain. Since exp(j*w_offset*n) turns into impulse function centred on w_offset, the multiplication shifts the H(w) by w_offset.

See Discrete Time Fourier Transform for more details.

Note: such a filter will not be symmetric about 0, which means it will have complex values. To make it symmetric, you need to add h[n] multiplied by exp(-j*w_offset*n):

h_bandpass[n] = h[n](exp(j*w_offset*n)+exp(-j*w_offset*n))

Since cos(w*n) = (exp(j*w*n)+exp(-j*w*n))/2 we get:

h_bandpass[n] = h[n]cos(w_offset*n)

This filter then has purely real values.

like image 152
freespace Avatar answered Nov 15 '22 14:11

freespace


The short answer is that you will multiply by a complex exponential in the time domain. Multiplication in the time domain will shift the signal in the frequency domain.

Matlab code:

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) );

p.s. I happened to have just implemented this exact functionality for school a couple of weeks ago.

Here is code for creating your own band pass filter using the windowing method:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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()

Example on how to use this function:

h_bpf_hammingWindow = BPF_hammingWindow( 36, pi/4, 3*pi/4 );
freqz(h_bpf_hammingWindow); % View the frequency domain
like image 36
Trevor Boyd Smith Avatar answered Nov 15 '22 13:11

Trevor Boyd Smith