How to design a IIR highpass filter?

조회 수: 7 (최근 30일)
Jimmy
Jimmy 2014년 12월 16일
댓글: Star Strider 2024년 10월 23일
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
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');
Error using ellipap2 (line 39)
The filter order is too large. Use a smaller value.

Error in ellipap (line 43)
[z,p,H0] = ellipap2(n,rp,rs);

Error in ellip (line 42)
[z,p,k] = ellipap(n, Rp, Rs);
[sos,g] = zp2sos(z,p,k);
figure
freqz(sos, 2^16, Fs)
You wiill have to do this yourself.
Good luck!
.

댓글을 달려면 로그인하십시오.

답변 (1개)

Prasanna
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:

카테고리

Help CenterFile Exchange에서 Filter Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by