Skip to content

Make the length of the frequency response adjustable #562

@Judochopalots

Description

@Judochopalots

When calling H, w = freqresp(filter) the returned frequency axis w is fixed at 257 rows.

This is an issue when someone (like me for example) needs a higher resolution along the frequency axis.

Matlab has an optional argument n which is used to specify the length of the axis required.
https://ch.mathworks.com/help/signal/ref/freqz.html

Scipy also has worN as an optional argument allowing this to be specified.
https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.freqz.html

I would suggest adding something similar.

I suppose it should be simple enough to implement, just add the length as an optional argument to the freqresp call.

"""
H, w = freqresp(filter)
Frequency response `H` of a `filter` at (normalized) frequencies `w` in
radians/sample for a digital filter or radians/second for an analog filter
chosen as a reasonable default.
"""

Then pass it also into the _freqrange call.

_freqrange(::FilterCoefficients{:z}) = range(0, stop=π, length=257)

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions