FIR filter implementation to ECG
7 views (last 30 days)
I am trying to write a Matlab function that implements an FIR filter with impulse response in the form value myFIR(value, coefficients),where both the value argument adn return value are scalars
Does anyone understand the function output = myFIR(input,hn)? Can explain it to me?
Patrik Ek on 14 Nov 2013
If I have understood correctly you have a FIR filter which you want to implement on a signal input in matlab. MATLAB have already a function that can do that. It is called filter and the syntax is
y = filter(b,a,x)
b is a vector with the coefficients of the nominator in an IIR filter and a is the denominator. The filter is a direct form II transpose type IIR filter. If you want you can create a filter object using dfilt to create an IIR filter of another kind. Then implement it as
y = filter(h,x)
h is the filter object. This should not be necessary for you though since your filter is a FIR type. The first coefficient in a need to be set to one. Otherwise MATLAB normalizes it. For you a should be a scalar with value 1.
Fo more information use the help of filter.