Domanda

Ho un filtro passa-basso descritto dalla seguente funzione di trasferimento:

h [n] = (w_c / Pi) * sinc (n * w_c / Pi), dove w_c è la frequenza di taglio

Devo convertire questo filtro passa-basso in un filtro passa-banda.

È stato utile?

Soluzione

Il h [n] si trasforma in un rect nel dominio della frequenza. Per far passare la tua banda devi spostare la sua frequenza centrale più in alto.

Per fare ciò, moltiplica h [n] per exp (j * w_offset * n) , dove w_offset è l'importo da spostare . Se w_offset è positivo, si passa a frequenze più alte.

La moltiplicazione nel dominio del tempo è una convoluzione nel dominio della frequenza. Poiché exp (j * w_offset * n) si trasforma in funzione impulso centrata su w_offset , la moltiplicazione sposta H (w) di w_offset .

Vedi Trasformata di Fourier a tempo discreto per maggiori dettagli.

Nota : tale filtro non sarà simmetrico su 0, il che significa che avrà valori complessi. Per renderlo simmetrico, devi aggiungere h [n] moltiplicato per exp (-j * w_offset * n) :

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

Poiché cos (w * n) = (exp (j * w * n) + exp (-j * w * n)) / 2 otteniamo:

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

Questo filtro ha quindi valori puramente reali.

Altri suggerimenti

La risposta breve è che si moltiplicherà per un esponenziale complesso nel dominio del tempo. La moltiplicazione nel dominio del tempo sposterà il segnale nel dominio della frequenza.

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

P.S. Mi è capitato di aver implementato questa esatta funzionalità per la scuola un paio di settimane fa.

Ecco il codice per creare il tuo filtro passa banda usando il metodo windowing:

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

Esempio su come utilizzare questa funzione:

h_bpf_hammingWindow = BPF_hammingWindow( 36, pi/4, 3*pi/4 );
freqz(h_bpf_hammingWindow); % View the frequency domain

Lascia che f [n] sia il segnale che ricevi dal filtro passa-basso con w_c sul limite inferiore della banda desiderata. È possibile ottenere le frequenze al di sopra di questo limite inferiore sottraendo f [n] dal segnale originale. Questo è l'input desiderato per il secondo filtro passa-basso.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top