Design FIR Low Pass filter using I-type linear phase, according to the parameters as follow, by matlab code:
时间: 2024-02-18 11:59:05 浏览: 58
Sure! Here is the Matlab code for designing an I-type linear phase FIR low pass filter according to the given parameters:
```
% Define filter parameters
Fs = 1000; % Sampling frequency
Fpass = 100; % Passband frequency
Fstop = 150; % Stopband frequency
Ap = 0.1; % Passband ripple (dB)
Ast = 80; % Stopband attenuation (dB)
% Normalize frequencies
Wpass = 2*Fpass/Fs;
Wstop = 2*Fstop/Fs;
% Determine filter order
N = ceil((Ast-8)/(4.57*(Wstop-Wpass))+1);
% Design filter using firpm function
b = firpm(N, [0 Wpass Wstop 1], [1 1 0 0], [10^(-Ap/20) 10^(-Ast/20)]);
% Plot magnitude and phase response
freqz(b,1,Fs)
```
In this code, we first define the filter parameters including the sampling frequency, passband frequency, stopband frequency, passband ripple, and stopband attenuation. We then normalize the frequencies to be between 0 and 1 for use with the firpm function. The filter order is determined using the Kaiser formula, and the filter is designed using the firpm function with a window that transitions from 1 in the passband to 0 in the stopband. Finally, we plot the magnitude and phase response of the filter using the freqz function.
Note that the resulting filter coefficients are stored in the variable b, which can be used to filter a signal using the filter function in Matlab.
阅读全文