# FIR filter designing in Matlab

I am studying digital signal processing and our professor gave us a task of modulation and demodulation and designing an appropriate FIR low-pass filter in Matlab.

I have done the modulation and demodulation but I am stuck on the filter designing. I want to know how the coefficients of filer are determined.

Have a look at the examples for fir1, fir2, or firpm. The first two are straightforward, while firpm is a little more complicated as it derives the minimum filter length needed to match the design criteria, but it's handy to know.

For a simple lowpass filter this should be enough: Feel free to play around with N or look into using firpm to get the minimum order of N.

fc = 100; fs = 1024; N = 256;
b = fir1(N, 2*fc/fs);
freqz(b, 1, 65536, fs)


I've been playing around with this web-based software, which seems to solve your problem quite nicely:

http://www.micromodeler.com/dsp


I've mostly been using it for the ARM Cortex, but it generates code for Matlab also.

It takes seconds to drag, drop and edit a filter and have it produce the matlab code. The filter length is limited in the demo version, but you can use a lower length filter then tune it manually afterwards.

It might come in useful if you ever need to quickly design a filter in the future and produce Matlab code for it.