How to design a IIR highpass filter?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Star Strider
el 23 de Oct. de 2024
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!
.
Respuestas (1)
Prasanna
el 23 de Oct. de 2024
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 comentarios
Ver también
Categorías
Más información sobre Filter Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!