# Are there rational transfer functions available in Julia?

Are there available rational transfer functions, possibly equivalent to MATLAB’s functions filter(b,1,x) and filter(b,a,x,zi) where zi are initial conditions for filter delays. Thanks in advance!

1 Like

I haven’t used filter in MATLAB, but isn’t this simply defining a system:

y = \frac{b_0 + b_1 z^{-1} + \ldots + b_{n_b} z^{-n_b}}{1+a_1 z^{-1}+\ldots+a_{n_a}z^{-n_a}}z^{-n_d} \cdot u

where n_a \ge n_b (assuming a proper system) and n_d a possible delay? And then using x as input (u) and computing the resulting output y?

If so, this can be handled with relative ease by defining a transfer function using the ControlSystems.jl package and simulating the resulting dynamic system with x as input.

The ControlSystems.jl package has built-in set-ups for the case that x (or: u) is a step input or an impulse input.

But there is also a function lsim for simulating the system with a specified input.

Note: I haven’t tested ControlSystems.jl for this particular case, though.

DSP.jl has your requested filter methods. Controlsystems.jl does have a more general support for transfer functions as they are commonly used in control, but for filtering, DSP.jl is what you want.

3 Likes

Ah. DSP.filt(b,a,x,[si]), etc. seems to be what is asked for.

2 Likes

Thank you very much to both!

1 Like