[OT] How to produce IIR filter coefficients from a set of points describing the frequency response

View: New views
8 Messages — Rating Filter:   Alert me  

[OT] How to produce IIR filter coefficients from a set of points describing the frequency response

by Andres Cabrera :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

The subject asks the question... What I want to know is if there's an
easy way using something like pylab and numpy to produce a set of
coefficients for an IIR filter from a given frequency response.
I've read on the internet that matlab has the invresz function which
does this, but is there an easy way with free software?

Cheers
Andrés

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: [OT] How to produce IIR filter coefficients from a set ofpoints describing the frequency response

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

scipy has a signal processing module:

NAME
    scipy.signal

FILE
    c:\python25\lib\site-packages\scipy\signal\__init__.py

DESCRIPTION
    Signal Processing Tools
    =======================

     Convolution:

        convolve      --  N-dimensional convolution.
        correlate     --  N-dimensional correlation.
        fftconvolve   --  N-dimensional convolution using the FFT.
        convolve2d    --  2-dimensional convolution (more options).
        correlate2d   --  2-dimensional correlation (more options).
        sepfir2d      --  Convolve with a 2-D separable FIR filter.

     B-splines:

        bspline       --  B-spline basis function of order n.
        gauss_spline  --  Gaussian approximation to the B-spline basis
function.
        cspline1d     --  Coefficients for 1-D cubic (3rd order) B-spline.
        qspline1d     --  Coefficients for 1-D quadratic (2nd order)
B-spline.
        cspline2d     --  Coefficients for 2-D cubic (3rd order) B-spline.
        qspline2d     --  Coefficients for 2-D quadratic (2nd order)
B-spline.
        spline_filter --  Smoothing spline (cubic) filtering of a rank-2
array.

     Filtering:

        order_filter  --  N-dimensional order filter.
        medfilt       --  N-dimensional median filter.
        medfilt2      --  2-dimensional median filter (faster).
        wiener        --  N-dimensional wiener filter.

        symiirorder1  --  2nd-order IIR filter (cascade of first-order
systems).
        symiirorder2  --  4th-order IIR filter (cascade of second-order
systems)
.
        lfilter       --  1-dimensional FIR and IIR digital linear
filtering.

        deconvolve    --  1-d deconvolution using lfilter.

        hilbert       -- Compute the analytic signal of a 1-d signal.
        get_window    -- Create FIR window.

        detrend       -- Remove linear and/or constant trends from data.
        resample      -- Resample using Fourier method.

     Filter design:

        remez         -- Optimal FIR filter design.
        firwin        -- Windowed FIR filter design.
        iirdesign     -- IIR filter design given bands and gains.
        iirfilter     -- IIR filter design given order and critical
frequencies.
        freqs         -- Analog filter frequency response.
        freqz         -- Digital filter frequency response.

        unique_roots  -- Unique roots and their multiplicities.
        residue       -- Partial fraction expansion of b(s) / a(s).
        residuez      -- Partial fraction expansion of b(z) / a(z).
        invres        -- Inverse partial fraction expansion.

     Matlab-style IIR filter design:

     butter (buttord)  -- Butterworth
     cheby1 (cheb1ord) -- Chebyshev Type I
     cheby2 (cheb2ord) -- Chebyshev Type II
     ellip (ellipord)  -- Elliptic (Cauer)
     bessel            -- Bessel (no order selection available -- try
butterord)


  Linear Systems:

     lti     -- linear time invariant system object.
     lsim    -- continuous-time simulation of output to linear system.
     impulse -- impulse response of linear, time-invariant (LTI) system.
     step    -- step response of continous-time LTI system.

  LTI Reresentations:

     tf2zpk -- transfer function to zero-pole-gain.
     zpk2tf -- zero-pole-gain to transfer function.
     tf2ss  -- transfer function to state-space.
     ss2tf  -- state-pace to transfer function.
     zpk2ss -- zero-pole-gain to state-space.
     ss2zpk -- state-space to pole-zero-gain.

  Waveforms:

     sawtooth   -- Periodic sawtooth
     square     -- Square wave
     gausspulse -- Gaussian modulated sinusoid
     chirp      -- Frequency swept cosine signal

  Window functions:

     boxcar           -- Boxcar window
     triang           -- Triangular window
     parzen           -- Parzen window
     bohman           -- Bohman window
     blackman         -- Blackman window
     blackmanharris   -- Minimum 4-term Blackman-Harris window
     nuttall          -- Nuttall's minimum 4-term Blackman-Harris window
     flattop          -- Flat top window
     bartlett         -- Bartlett window
     hann             -- Hann window
     barthann         -- Bartlett-Hann window
     hamming          -- Hamming window
     kaiser           -- Kaiser window
     gaussian         -- Gaussian window
     general_gaussian -- Generalized Gaussian window
     slepian          -- Slepian window

  Wavelets:

     daub    -- return low-pass filter for daubechies wavelets
     qmf     -- return quadrature mirror filter from low-pass
     cascade -- compute scaling function and wavelet from coefficients

Victor
----- Original Message -----
From: "Andres Cabrera" <mantaraya36@...>
To: "Developer discussions" <csound-devel@...>
Sent: Friday, May 15, 2009 12:54 PM
Subject: [Cs-dev] [OT] How to produce IIR filter coefficients from a set
ofpoints describing the frequency response


Hi all,

The subject asks the question... What I want to know is if there's an
easy way using something like pylab and numpy to produce a set of
coefficients for an IIR filter from a given frequency response.
I've read on the internet that matlab has the invresz function which
does this, but is there an easy way with free software?

Cheers
Andrés

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Parent Message unknown Re: [OT] How to produce IIR filter coefficients from a set ofpoints describing the frequency response

by Jim Bates :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From: victor <Victor.Lazzarini@...>

This absolutely impressive, but scary!


True.  Running on OSX 10.4, 1.67 Ghz and 2 GB RAM, Sage will compute pi
to 100,000 places in just under 9 seconds.  It uses Cython which is a C extension
for Python.  It is quite fast.  ( http://cython.org/  )

All the Best,
Jim

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: [OT] How to produce IIR filter coefficients from a set ofpoints describing the frequency response

by Andres Cabrera :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the ideas. I've been playing with sage all afternoon and
it's great. I'd heard about it, but had not dared install it...
But on the topic of iir filter coeficients, I haven't been able to
find how... with scipy.signal, there are two functions for creating
filters: iirfiter and iirdesign, but they are not designed for
arbitrary filter responses, since they model classic bp, hp, lp and br
filters. I've found remez, but it's for fir filters.
Am I missing something?

Cheers,
Andrés


On Fri, May 15, 2009 at 5:14 PM, Jim Bates <jabates@...> wrote:

> From: victor <Victor.Lazzarini@...>
> This absolutely impressive, but scary!
>
> True.  Running on OSX 10.4, 1.67 Ghz and 2 GB RAM, Sage will compute pi
> to 100,000 places in just under 9 seconds.  It uses Cython which is a C
> extension
> for Python.  It is quite fast.  ( http://cython.org/  )
> All the Best,
> Jim
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>



--


Andrés

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: [OT] How to produce IIR filter coefficients from a set ofpoints describing the frequency response

by Andres Cabrera :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The matlab function I'm looking for is acually called invfreqz, not
invresz which is there in scipy.

Cheers,
Andrés

On Fri, May 15, 2009 at 9:08 PM, Andres Cabrera <mantaraya36@...> wrote:

> Thanks for the ideas. I've been playing with sage all afternoon and
> it's great. I'd heard about it, but had not dared install it...
> But on the topic of iir filter coeficients, I haven't been able to
> find how... with scipy.signal, there are two functions for creating
> filters: iirfiter and iirdesign, but they are not designed for
> arbitrary filter responses, since they model classic bp, hp, lp and br
> filters. I've found remez, but it's for fir filters.
> Am I missing something?
>
> Cheers,
> Andrés
>
>
> On Fri, May 15, 2009 at 5:14 PM, Jim Bates <jabates@...> wrote:
>> From: victor <Victor.Lazzarini@...>
>> This absolutely impressive, but scary!
>>
>> True.  Running on OSX 10.4, 1.67 Ghz and 2 GB RAM, Sage will compute pi
>> to 100,000 places in just under 9 seconds.  It uses Cython which is a C
>> extension
>> for Python.  It is quite fast.  ( http://cython.org/  )
>> All the Best,
>> Jim
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables
>> unlimited royalty-free distribution of the report engine
>> for externally facing server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@...
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>
>
>
> --
>
>
> Andrés
>



--


Andrés

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: [OT] How to produce IIR filter coefficients from a setofpoints describing the frequency response

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Octave seems to have it:
https://prof.hti.bfh.ch/sha1/Octave/index/f/invfreqz.html
----- Original Message -----
From: "Andres Cabrera" <mantaraya36@...>
To: "Developer discussions" <csound-devel@...>
Sent: Saturday, May 16, 2009 3:12 AM
Subject: Re: [Cs-dev] [OT] How to produce IIR filter coefficients from a
setofpoints describing the frequency response


The matlab function I'm looking for is acually called invfreqz, not
invresz which is there in scipy.

Cheers,
Andrés

On Fri, May 15, 2009 at 9:08 PM, Andres Cabrera <mantaraya36@...>
wrote:

> Thanks for the ideas. I've been playing with sage all afternoon and
> it's great. I'd heard about it, but had not dared install it...
> But on the topic of iir filter coeficients, I haven't been able to
> find how... with scipy.signal, there are two functions for creating
> filters: iirfiter and iirdesign, but they are not designed for
> arbitrary filter responses, since they model classic bp, hp, lp and br
> filters. I've found remez, but it's for fir filters.
> Am I missing something?
>
> Cheers,
> Andrés
>
>
> On Fri, May 15, 2009 at 5:14 PM, Jim Bates <jabates@...> wrote:
>> From: victor <Victor.Lazzarini@...>
>> This absolutely impressive, but scary!
>>
>> True. Running on OSX 10.4, 1.67 Ghz and 2 GB RAM, Sage will compute pi
>> to 100,000 places in just under 9 seconds. It uses Cython which is a C
>> extension
>> for Python. It is quite fast. ( http://cython.org/ )
>> All the Best,
>> Jim
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables
>> unlimited royalty-free distribution of the report engine
>> for externally facing server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@...
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>
>
>
> --
>
>
> Andrés
>



--


Andrés

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel 


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Parent Message unknown Re: [OT] How to produce IIR filter coefficients from a set ofpoints describing the frequency response

by Jim Bates :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the ideas. I've been playing with sage all afternoon and
it's great. I'd heard about it, but had not dared install it...
But on the topic of iir filter coeficients, I haven't been able to
find how... with scipy.signal, there are two functions for creating
filters: iirfiter and iirdesign, but they are not designed for
arbitrary filter responses, since they model classic bp, hp, lp and br
filters. I've found remez, but it's for fir filters.
Am I missing something?

Cheers,
Andr?s


I don't think you're missing anything--I'm not sure how to do what you
want in Sage.  SciLab might be easier.   ( http://www.scilab.org  )

There are several other options:

Octave can run matlab scripts, (if you have a matlab scipt for this)
and can be found here:   http://www.gnu.org/software/octave/

The other possibility is an on-line calculator I found here:

Online tool for IIR Filter and FIR Filter Design
(only for Windows platform)

As it only runs Windows, I wasn't able to test it, but it looks like it
would answer up to your requirements.

All the Best, 
Jim

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel

Re: [OT] How to produce IIR filter coefficients from a setofpoints describing the frequency response

by Andres Cabrera :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, that's what I was looking for. The great thing is that I can use
this from sage.

Thanks for the ideas.

Cheers,
Andrés

On Sat, May 16, 2009 at 1:20 AM, victor <Victor.Lazzarini@...> wrote:

> Octave seems to have it:
> https://prof.hti.bfh.ch/sha1/Octave/index/f/invfreqz.html
> ----- Original Message -----
> From: "Andres Cabrera" <mantaraya36@...>
> To: "Developer discussions" <csound-devel@...>
> Sent: Saturday, May 16, 2009 3:12 AM
> Subject: Re: [Cs-dev] [OT] How to produce IIR filter coefficients from a
> setofpoints describing the frequency response
>
>
> The matlab function I'm looking for is acually called invfreqz, not
> invresz which is there in scipy.
>
> Cheers,
> Andrés
>
> On Fri, May 15, 2009 at 9:08 PM, Andres Cabrera <mantaraya36@...>
> wrote:
>> Thanks for the ideas. I've been playing with sage all afternoon and
>> it's great. I'd heard about it, but had not dared install it...
>> But on the topic of iir filter coeficients, I haven't been able to
>> find how... with scipy.signal, there are two functions for creating
>> filters: iirfiter and iirdesign, but they are not designed for
>> arbitrary filter responses, since they model classic bp, hp, lp and br
>> filters. I've found remez, but it's for fir filters.
>> Am I missing something?
>>
>> Cheers,
>> Andrés
>>
>>
>> On Fri, May 15, 2009 at 5:14 PM, Jim Bates <jabates@...> wrote:
>>> From: victor <Victor.Lazzarini@...>
>>> This absolutely impressive, but scary!
>>>
>>> True. Running on OSX 10.4, 1.67 Ghz and 2 GB RAM, Sage will compute pi
>>> to 100,000 places in just under 9 seconds. It uses Cython which is a C
>>> extension
>>> for Python. It is quite fast. ( http://cython.org/ )
>>> All the Best,
>>> Jim
>>> ------------------------------------------------------------------------------
>>> Crystal Reports - New Free Runtime and 30 Day Trial
>>> Check out the new simplified licensing option that enables
>>> unlimited royalty-free distribution of the report engine
>>> for externally facing server and web deployment.
>>> http://p.sf.net/sfu/businessobjects
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>>
>>
>>
>>
>> --
>>
>>
>> Andrés
>>
>
>
>
> --
>
>
> Andrés
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@...
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



--


Andrés

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Csound-devel mailing list
Csound-devel@...
https://lists.sourceforge.net/lists/listinfo/csound-devel