Search code examples
matlabfiltersignal-processingnoise

FIR filter understanding matlab


i'm trying to understand the fir1 filter but i still don't get it. For example here i got an audio signal that i consider noise, i'm passing it through a low pass filter.

n = 100000
fs = 11025
handles.noise = wavrecord(n, fs, 'double');
nfilt = fir1(11,0.4); 
fnoise = filter(nfilt,1,handles.noise); 

Why did i need to pass the noise signal to a low pass filter in the first place? and why is the number of coefficients 11? also the 0.4 shouldn't it be a range of values?

I know these are a lot of questions but when i get to understand them, ill be grateful to everyones help.


Solution

  • For your first question:

    Why did i need to pass the noise signal to a low pass filter in the first place?

    Supposing that the noise you have in your signal is high frequency (higher than the useful signal itself) this is the job of a low-pass filter.

    From Wikipedia:

    A low-pass filter is a filter that passes signals with a frequency lower than a certain cutoff frequency and attenuates signals with frequencies higher than the cutoff frequency.

    Your other two questions should be answered if you take a look in the documentation for the fir1 function here:

    http://www.mathworks.com/help/signal/ref/fir1.html#inputarg_Wn