'Bandpass Butter filter' bode plot seems to not take into account the lower cutoff frequency

21 views (last 30 days)
Hi everyone,
I am working on signal processing on MatLab, and I need to filter my data using a Butterworth bandpass transfer function. I wanted to verify the accuracy of the filter by plotting the bode diagram of the filter. For that, I used the following code:
fs=100; % Sampling frequency
fny=fs/2; % Nyquist frequency
fb=1/120; % Lower cutoff frequency (max instrument detection period = 120s)
fh=fny-1; % Upper cutoff frequency (anti-aliasing at fs/2)
Wn=[fb/fny fh/fny];
[b1,a1] = butter(4,Wn,'bandpass'); % Butterworth transfer function coefficients
G1=tf(b1,a1); % Transfer function
figure; % Bode plot
bode(G1)
However, this gives me the following plot:
BodePlot.png
I was not expecting this for a bandpass filter, because it seems that the lower cutoff frequency is not taken into account, but I cannot understand why. If anyone as any explanation about this, I would be very grateful.

Accepted Answer

Star Strider
Star Strider on 17 May 2019
The bode function needs to know that you are plotting a discrete filter, because the filter coefficients are different than for a continuous-time (analogue) filter. It will plot the lower cutoff frequency with:
G1=tf(b1,a1,1/fs); % Transfer function
because you are telling it that your filter is discrete rather than continuous. The upper cutoff frequency of your fillter is approximately the Nyquist frequency, so this plot appears to be correct.
It might be easier to use the Signal Processing Toolbox freqz function to plot discrete filter characteristics:
figure
freqz(b1,a1,2^14,fs)

More Answers (0)

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!