Skip to content

Commit 686f701

Browse files
committed
bugfix: Fixes #253, misplaced 2 in *(Number, DelayLTISystem).
1 parent bf65293 commit 686f701

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/types/DelayLtiSystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Base.convert(::Type{V}, sys::DelayLtiSystem) where {T, V<:DelayLtiSystem{T}} =
7272

7373
function *(sys::DelayLtiSystem, n::Number)
7474
new_C = [sys.P.C1*n; sys.P.C2]
75-
new_D = [sys.P.D11*n sys.P.D12; sys.P.D21*n sys.P.D22]
75+
new_D = [sys.P.D11*n sys.P.D12*n; sys.P.D21 sys.P.D22]
7676
return DelayLtiSystem(StateSpace(sys.P.A, sys.P.B, new_C, new_D, sys.P.Ts), sys.Tau)
7777
end
7878
*(n::Number, sys::DelayLtiSystem) = *(sys, n)

test/test_delayed_systems.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ P2_fr = (im*ω .+ 1) ./ (im*ω .+ 2)
3131
# Substraction
3232
@test freqresp(P1 - delay(1), ω)[:] P1_fr .- exp.(-im*ω)
3333

34+
## Multiplication by scalar
35+
@test freqresp(2*delay(1), ω)[:] 2*exp.(-im*ω)
36+
@test freqresp(2*(P1*delay(1)), ω)[:] 2*P1_fr.*exp.(-im*ω)
3437

3538
## Multiplication
3639
@test freqresp(P1 * delay(1), ω)[:] P1_fr .* exp.(-im*ω) rtol=1e-15

0 commit comments

Comments
 (0)