How to design a IIR highpass filter?
조회 수: 7 (최근 30일)
이전 댓글 표시
I'm having trouble to design a 120th order highpass filter with cutoff frequency = 6kHz, and sampling frequency of 20kHz. Thank you in advance.
댓글 수: 1
Star Strider
2024년 10월 23일
A 120-order filter?
Fs = 2E+5;
n = 120;
Rp = 1;
Rs = 50;
Wp = 6E+3*2/Fs;
[z,p,k] = ellip(n, Rp, Rs, Wp, 'high');
[sos,g] = zp2sos(z,p,k);
figure
freqz(sos, 2^16, Fs)
You wiill have to do this yourself.
Good luck!
.
답변 (1개)
Prasanna
2024년 10월 23일
Hi Jimmy,
To design a highpass filter with specified cutoff frequency, you can use the ‘fir1’ function in MATLAB. To create the same, follow these steps:
- Define specifications of the filter and normalize the cutoff frequency with respect to the Nyquist frequency. Normalizing the cutoff frequency ensures that the filter design algorithms correctly interpret the frequency specifications relative to the sampling rate.
- Design the filter by using the ‘fir1’ function with the ‘high’ argument to specify that it is a high pass filter
A sample MATLAB code for the above is given as follows:
% Specifications
order = 120; % Filter order
cutoff_freq = 6000; % Cutoff frequency in Hz
sampling_freq = 20000; % Sampling frequency in Hz
% Normalize the cutoff frequency with respect to Nyquist frequency
nyquist_freq = sampling_freq / 2;
normalized_cutoff = cutoff_freq / nyquist_freq;
% Design the highpass filter using fir1
b = fir1(order, normalized_cutoff, 'high');
Higher order filters can sometimes be unstable, in which case replace them by using a lower order filter. You can also consider IIR filters with the ‘butter’, ‘cheby1’, or ‘ellip’ functions. For more information regarding the functions used, refer the following documentations:
- Fir1: https://www.mathworks.com/help/signal/ref/fir1.html
- Butterworth filter: https://www.mathworks.com/help/signal/ref/butter.html
- Chebyshev Type I filter: https://www.mathworks.com/help/signal/ref/cheby1.html
- Elliptic filter: https://www.mathworks.com/help/signal/ref/ellip.html
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Filter Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!