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

bugfix dcgain #551

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ equal to G(0) for continuous-time systems and G(1) for discrete-time systems.
the stability region of the complex plane.
"""
function dcgain(sys::LTISystem, ϵ=0)
return iscontinuous(sys) ? evalfr(sys, -ϵ) : evalfr(sys, exp(-ϵ*G.Ts))
return iscontinuous(sys) ? evalfr(sys, -ϵ) : evalfr(sys, exp(-ϵ*sys.Ts))
end

"""
Expand Down
2 changes: 2 additions & 0 deletions test/test_analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ z, p, k = zpkdata(G)
## GAIN ## #Gain is confusing when referring to zpkdata. Test dcgain instead
@test [dcgain(H[1, 1]) dcgain(H[1, 2]); dcgain(H[2, 1]) dcgain(H[2, 2])] ≈ [0 0; 0.2 1/3]
@test [dcgain(G[1, 1]) dcgain(G[1, 2]); dcgain(G[2, 1]) dcgain(G[2, 2])] ≈ [0 0; 0.2 1/3]
@test dcgain(H[1, 1], 1e-6)[] == 0
@test dcgain(H[2, 1], 1e-6)[] ≈ 0.2 rtol=1e-5

## MARKOVPARAM ##
@test markovparam(G, 0) == [0.0 0.0; 1.0 0.0]
Expand Down