Skip to content

Commit d062189

Browse files
committed
Fixed printing of complex zpk models.
1 parent 5cc05fc commit d062189

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/types/SisoTfTypes/SisoZpk.jl

+9-6
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ Base.zero(f::SisoZpk) = zero(typeof(f))
5353
tzero(sys::SisoZpk) = f.z # Do minreal first?,
5454
pole(sys::SisoZpk) = f.p # Do minreal first?
5555

56-
numpoly(f::SisoZpk{<:Real}) = f.k*prod(roots2real_poly_factors(f.z)) # QUESTION: Include f.k?
56+
numpoly(f::SisoZpk{<:Real}) = f.k*prod(roots2real_poly_factors(f.z))
5757
denpoly(f::SisoZpk{<:Real}) = prod(roots2real_poly_factors(f.p))
5858

59-
numpoly(f::SisoZpk) = prod(roots2complex_poly_factors(f.z))
59+
numpoly(f::SisoZpk) = f.k*prod(roots2complex_poly_factors(f.z))
6060
denpoly(f::SisoZpk) = prod(roots2complex_poly_factors(f.p))
6161

6262
num(f::SisoZpk) = reverse(coeffs(numpoly(f))) # FIXME: reverse?!
@@ -156,11 +156,14 @@ function poly_factors2string(poly_factors, var)
156156
end
157157
end
158158

159-
# TODO: add print function for complex coefficient polynomial factors
160159
function print_siso(io::IO, t::SisoZpk, var=:s)
161-
numstr = poly_factors2string(roots2real_poly_factors(t.z), var)
162-
denstr = poly_factors2string(roots2real_poly_factors(t.p), var)
163-
160+
if typeof(t.k) <: Real
161+
numstr = poly_factors2string(roots2real_poly_factors(t.z), var)
162+
denstr = poly_factors2string(roots2real_poly_factors(t.p), var)
163+
else
164+
numstr = poly_factors2string(roots2complex_poly_factors(t.z), var)
165+
denstr = poly_factors2string(roots2complex_poly_factors(t.p), var)
166+
end
164167
# Figure out the length of the separating line
165168
len_num = length(numstr)
166169
len_den = length(denstr)

0 commit comments

Comments
 (0)