Designing a Butterworth filter given center frequency

4 visualizaciones (últimos 30 días)
Fahad Ahmed
Fahad Ahmed el 15 de Nov. de 2016
Respondida: Star Strider el 15 de Nov. de 2016
Hi, all!
I'm a student just now starting get a handle on Matlab and I'm having trouble with an assignment. I have to design a 10th order Butterworth bandpass filter with center frequency of 1000 Hz. This is the code I've got so far
Fc = 1000;
F1 = 500;
F2 = 1500;
W1 = 2*pi*F1;
W2 = 2*pi*F2;
Fn = 10000
Wp = [W1 W2]/Fn
[b,a] = butter(5,Wp,'bandpass');
figure(1);
freqz(b,a);
I'm getting about the expected shape of the magnitude plot but the center is at 0.5 and I can't for the life of me move it. What am I missing? Is my approach completely wrong? Let me know if I've left out any information or if I'm being an idiot or something. Thanks for the help!

Respuestas (1)

Star Strider
Star Strider el 15 de Nov. de 2016
Your design is correct. Your code isn’t. You need to define your passband as normalised frequencies with respect to your Nyquist frequency. This is easy to see in your freqz call if you include the sampling frequency. (I chose a FFT length of 4096 arbitrarily. Nothing magic about it.)
This gives the result you describe as your objective:
Fc = 1000;
F1 = 500;
F2 = 1500;
Fs = 20000; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [F1 F2]/Fn; % <— DEFINE THE PASSBAND THIS WAY
[b,a] = butter(5,Wp,'bandpass');
figure(1);
freqz(b,a, 4096, Fs); % <— INCLUDE ‘Fs’ HERE

Community Treasure Hunt

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

Start Hunting!

Translated by