Last active
August 21, 2022 13:42
-
-
Save pineapplehunter/bf75b8d67a1d6859dfabd8dc7d987c31 to your computer and use it in GitHub Desktop.
Julia DSP.jl Filter plot like MATLAB zplane
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DSP | |
using RecipesBase | |
@recipe function plot( | |
f::FilterCoefficients; | |
xguide = "Real part", | |
yguide = "Imaginary part", | |
legend = true, | |
unitcolor = :auto, | |
zerocolor = :auto, | |
zeromarker = :o, | |
polecolor = :auto, | |
polemarker = :x, | |
) | |
f = ZeroPoleGain(f) | |
xguide := xguide | |
yguide := yguide | |
@series begin | |
seriestype := :path | |
label := "" | |
marker := :none | |
linestyle := :dash | |
seriescolor := unitcolor | |
cos, sin, 0, 2 * π | |
end | |
seriestype := :scatter | |
aspect_ratio := :equal | |
@series begin | |
label := "zero" | |
marker := zeromarker | |
markercolor := zerocolor | |
Complex.(f.z) | |
end | |
@series begin | |
label := "pole" | |
marker := polemarker | |
markercolor := polecolor | |
Complex.(f.p) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That is wonderful, thank you!