Designing a bandpass filter in Matlab
Mostra commenti meno recenti
Hi,
I am trying to implement an FIR bandpass filter, with a pass band from ~350KHz to ~700KHz.
For that, I am using the fir1 function.
My signal is sampled at 10Mhz and the number of sample points are ~126M.
For the bandpass filter I use the following code:
%% testing
Fs = 1e7; % sampling frequency
L = 126204866; % length of signal
% Parameters for the implementation of a BandPass filter
f3 = 300e3; % low cut-off frequency for Bandpass: 700e3, 300e3
f4 = 750e3; % high cut-off frequency for Bandpass: 1450e3, 750e3
fpass = [f3 f4];
hc = fir1(200,fpass/Fs,"bandpass");
% Break the frequency axis into "L" bins/buckets
f = (-0.5:1/L:0.5-1/L)*Fs; % create the frequency vector (frequency X-axis)
Y = 20*log10(abs(fftshift(fft(hc,L))));
figure;
reduce_plot(f,Y);
axis([0 Fs/2 -60 20])
title('Filter Frequency Response')
grid on
If I use the frequencies f3 = 300KHz and f4 = 750 KHz, I get the following filter frequency response:

As can be seen the 3db attenuation is at ~170KHz and ~355KHz.
On the other hand, if I use frequencies f3 = 700KHz and f4 = 1450 KHz, I get the desired filter frequency response:

As can be seen the 3db attenuation is at ~370KHz and ~705KHz.
It seems that I need to double the input frequencies I use in fir1 function to get the desired frequency response.
Could somebody explain what is the cause for this?
I am using Matlab R2021b.
Thank you in advance for your response and time.
-Nassos
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Frequency Transformations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
