What is fir2 in Matlab?
b = fir2( n , f,m ) returns an n th-order FIR filter with frequency-magnitude characteristics specified in the vectors f and m . The function linearly interpolates the desired frequency response onto a dense grid and then uses the inverse Fourier transform and a Hamming window to obtain the filter coefficients.
Why use a FIR filter?
Stability: As FIRs do not use previous output values to compute their present output, i.e. they have no feedback, they can never become unstable for any type of input signal, which is gives them a distinct advantage over IIR filters.
How to use Firpm in Matlab?
If you specify an odd-valued n , firpm increments it by 1. b = firpm(n,f,a,w) uses the weights in vector w to weight the fit in each frequency band. The length of w is half the length of f and a , so there is exactly one weight per band. b = firpm(n,f,a,w) is a synonym for b = firpm(n,f,@ firpmfrf ,a,w).