From 207785ed1c4beaceb5f4cf99d878c03401af5aff Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Wed, 22 Dec 2021 08:08:13 +0100 Subject: [PATCH] scalar mul for tf --- src/types/TransferFunction.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/types/TransferFunction.jl b/src/types/TransferFunction.jl index d02acb591..7131537ab 100644 --- a/src/types/TransferFunction.jl +++ b/src/types/TransferFunction.jl @@ -133,10 +133,13 @@ end function *(G1::TransferFunction, G2::TransferFunction) # Note: G1*G2 = y <- G1 <- G2 <- u timeevol = common_timeevol(G1,G2) - if G1.nu != G2.ny + if G1.nu == G2.ny + matrix = G1.matrix * G2.matrix + elseif issiso(G1) || issiso(G2) + matrix = G1.matrix .* G2.matrix + else error("G1*G2: G1 must have same number of inputs as G2 has outputs") end - matrix = G1.matrix * G2.matrix return TransferFunction(matrix, timeevol) end