How to create a simple FIR filter using Matlab?

How can I make a simple low-pass FIR filter using Matlab (without using the built-in function)?

Example problem:

Implement a FIR LPF with cut-off frequency 250Hz

it may also be required that the sample rate be set ...

Solution or what I already know:

x = [...] -> input signal
A = 1; -> Since this is FIR
B = [?????]
y = filter(B, A, x) -> Output signal

Afaik, B must contain the coefficients for the FIR filter. But; How can I calculate these coefficients, given that I have a cutoff frequency?

+5
source share
3 answers

The simplest thing is the window sinc filter:

fs = 44100;
cutoff = 250;
t = -256:256;  % This will be a 513-tap filter
r = 2*cutoff/fs;
B = sinc(r*t).*r .* blackman(length(t))';
freqz(B);

(. t=...) . cutoff - -6 . blackman - . . .

+11

, , sellibitze, sinc ( ).

0

LTI , Matlab, , FFT , , , soemthing like A = [ 1 .9 .8 .5 .2 .1 0], theta=[0 0 0 0 0 0 0], H=A.*exp(j*theta), coefs = ifft(H)

0
source

All Articles