Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 6.1.0. This page might be outdated.
See the recommended documentation of this function

# filter

filters a data sequence using a digital filter

### Calling Sequence

`[y,zf] = filter(B, A, x [,zi])`

### Arguments

B

real vector : the coefficients of the filter numerator in decreasing power order, or a polynomial.

A

real vector : the coefficients of the filter denominator in decreasing power order, or a polynomial.

x

real row vector : the input signal

zi

real row vector of length `max(length(a),length(b))-1`: the initial condition relative to a "direct form II transposed" state space representation. The default value is a vector filled with zeros.

y

real row vector : the filtered signal.

zf

real row vector : the final state. It can be used to filter a next batch of the input signal.

### Description

This function filters a data sequence using a digital filter using a "direct form II transposed" implementation.

The filter canonical form is :

The algorithm uses the highest degree between `degree(a)` and `degree(b)` as value for `n`.

If the polynomial form is used for `B` (resp. for `A`) then a polynomial or a scalar must be used for `A` (resp. `B`).

### References

Oppenheim, A. V. and R.W. Schafer. Discrete-Time Signal Processing, Englewood Cliffs, NJ: Prentice-Hall, 1989, pp. 311-312.

### Examples

```x = [1 zeros(1,9)]
h = [0 0 1];
res = filter(h, 1, x) //This creates a delay of 2 elements

z = poly(0, "z");
B = 1;
A = z^2;
// B/A is z^(-2)
// the resulting filter is also a delay of 2 elements
res = filter(B, A, x)

//Integrator filter
x = ones(1,10)
B = 1;
A = [1 -1];
res = filter(B, A, x)```

### See Also

• flts — time response (discrete time, sampled system)
• rtitr — discrete time response (transfer matrix)
• ltitr — discrete time response (state space)

### Comments

Add a comment:
Please login to comment this page.

 Report an issue << ffilt filters find_freq >>

 Scilab EnterprisesCopyright (c) 2011-2017 (Scilab Enterprises)Copyright (c) 1989-2012 (INRIA)Copyright (c) 1989-2007 (ENPC)with contributors Last updated:Wed Apr 01 10:24:17 CEST 2015