# How to get the a and b coefficients out of the DSP digital filter function?

**URL:** <https://discourse.julialang.org/t/how-to-get-the-a-and-b-coefficients-out-of-the-dsp-digital-filter-function/122516>\
**Category:** Signal and Image Processing\
**Tags:** dsp\
**Created:** [November 11, 2024, 9:52pm UTC](https://discourse.julialang.org/t/how-to-get-the-a-and-b-coefficients-out-of-the-dsp-digital-filter-function/122516 "2024-11-11T21:52:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nine\_Cycles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nine_cycles/32/213342_2.png) [@Nine\_Cycles](https://discourse.julialang.org/u/Nine_Cycles)\
**Post date:** [November 11, 2024, 9:52pm UTC](https://discourse.julialang.org/t/how-to-get-the-a-and-b-coefficients-out-of-the-dsp-digital-filter-function/122516/1 "2024-11-11T21:52:17Z")

</div>

Hello, i want to get the a and b coefficients of a digital Butterworth filter in Julia.

I have to iteratively compute the results for live-sound purpose, so I cannot use a filter() function.

Here is where my code is at  
"Wn = 1/120

```
lowpass_filter = digitalfilter(Lowpass(Wn),Butterworth(4))

filter_tf = tf(zpk(lowpass_filter.z, lowpass_filter.p, lowpass_filter.k))"

```

I know that the coefficients a re in the polynomial field of filter\_tf, but don’t know yet how to get them out.

If you know how (how a simpler solution) I would really appreciate.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 11, 2024, 10:11pm UTC](https://discourse.julialang.org/t/how-to-get-the-a-and-b-coefficients-out-of-the-dsp-digital-filter-function/122516/2 "2024-11-11T22:11:29Z")

</div>

Have you looked at DSP.jl 's functions `coefa()` and `coefb()` ?  
E.g:

```julia
coefa(lowpass_filter)
coefb(lowpass_filter)

```

---

<div class="post-metadata">

**Author:** ![Nine\_Cycles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nine_cycles/32/213342_2.png) [@Nine\_Cycles](https://discourse.julialang.org/u/Nine_Cycles)\
**Post date:** [November 11, 2024, 10:15pm UTC](https://discourse.julialang.org/t/how-to-get-the-a-and-b-coefficients-out-of-the-dsp-digital-filter-function/122516/3 "2024-11-11T22:15:47Z")

</div>

Thank you.
