Skip to content

Commit

Permalink
fixed docstring for freqresp, closes JuliaControl#461
Browse files Browse the repository at this point in the history
  • Loading branch information
olof3 committed May 24, 2021
1 parent ae87d97 commit 9dfca42
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/freqresp.jl
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
"""sys_fr = freqresp(sys, w)
""" freqresp(G, Ω) -> G_fr
Evaluate the frequency response of a linear system
`w -> C*((iw*im -A)^-1)*B + D`
of system `sys` over the frequency vector `w`."""
@autovec () function freqresp(sys::LTISystem, w_vec::AbstractVector{<:Real})
Evaluate the frequency response of the linear system `G` at frequencies `Ω`.
(for a discrete-system with sample time `Ts` the frequency repsonse is evaluated in
points `exp.(Ω*(im*Ts))` on the unit circle.
"""
@autovec () function freqresp(G::LTISystem, Ω::AbstractVector{<:Real})
# Create imaginary freq vector s
if iscontinuous(sys)
s_vec = im*w_vec
if iscontinuous(G)
s_vec = im*Ω
else
s_vec = exp.(w_vec*(im*sys.Ts))
s_vec = exp.(Ω*(im*G.Ts))
end
#if isa(sys, StateSpace)
# sys = _preprocess_for_freqresp(sys)
#if isa(G, StateSpace)
# G = _preprocess_for_freqresp(G)
#end
ny,nu = noutputs(sys), ninputs(sys)
[evalfr(sys[i,j], s)[] for s in s_vec, i in 1:ny, j in 1:nu]
ny, nu = size(G)
[evalfr(G[i,j], s)[] for s in s_vec, i in 1:ny, j in 1:nu]
end


# Implements algorithm found in:
# Laub, A.J., "Efficient Multivariable Frequency Response Computations",
# IEEE Transactions on Automatic Control, AC-26 (1981), pp. 407-408.
Expand Down

0 comments on commit 9dfca42

Please sign in to comment.