Designing a Butterworth filter given center frequency
조회 수: 4 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (1개)
Star Strider
2016년 11월 15일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Analog Filters에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!