Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interface to DSP #843

Merged
merged 5 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add docs on filter design
  • Loading branch information
baggepinnen committed May 22, 2023
commit 3f9726b5582362812e1a532cbcca07edf34c82b0
1 change: 1 addition & 0 deletions docs/src/lib/constructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ zpk
delay
pade
ssdata
ControlSystemsBase.seriesform
```
17 changes: 16 additions & 1 deletion docs/src/man/creating_systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,19 @@ uF │ │ │ │ ├──────► │ yC │ uP
└───────────────────────────────────┘
```

See code example [complicated_feedback.jl](https://github.com/JuliaControl/RobustAndOptimalControl.jl/blob/master/examples/complicated_feedback.jl).
See code example [complicated_feedback.jl](https://github.com/JuliaControl/RobustAndOptimalControl.jl/blob/master/examples/complicated_feedback.jl).

## Filter design
Filters can be designed using [DSP.jl](https://docs.juliadsp.org/stable/filters/). This results in filter objects with types from the DSP package, which can be converted to transfer functions using [`tf`](@ref) from ControlSystemsBase.

```@example FilterDesign
using DSP, ControlSystemsBase, Plots

fs = 100
df = digitalfilter(Bandpass(5, 10; fs), Butterworth(2))
G = tf(df, 1/fs) # Sample time must be provided in the conversion to get the correct frequency scale in the Bode plot
bodeplot(G, xscale=:identity, yscale=:identity, hz=true)
```

See also
- [`ControlSystemsBase.seriesform`](@ref)
2 changes: 1 addition & 1 deletion lib/ControlSystemsBase/src/dsp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end


"""
Gs, k = seriesform(G::TransferFunction)
Gs, k = seriesform(G::TransferFunction{Discrete})

Convert a transfer function `G` to a vector of second-order transfer functions and a scalar gain `k`, the product of which equals `G`.
"""
Expand Down