# matlab, filter function

Kenny Ortmann kortmann at ideaworks.com
Tue Oct 17 13:35:25 CDT 2006

```just looking for some help, most of the time you guys are good with matlab
code, i am trying to use the filter function under this setting

y = filter(b,a,X) filters the data in vector X with the filter described by
numerator coefficient vector b and denominator coefficient vector a. If a(1)
is not equal to 1, filter normalizes the filter coefficients by a(1). If
a(1) equals 0, filter returns an error.

I pretty much have the same as the example, except my data array is
different
data = [1:0.2:4]';
windowSize = 5;
filter(ones(1,windowSize)/windowSize,1,data)
ans =
0.2000
0.4400
0.7200
1.0400
1.4000
1.6000
1.8000
2.0000
2.2000
2.4000
2.6000
2.8000
3.0000
3.2000
3.4000
3.6000

my question is does numpy/scipy have a function for this, if not the
algorithm states
y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
- a(2)*y(n-1) - ... - a(na+1)*y(n-na)but a is a number not
an arrayThanks for the help,~Kenny

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier