JuliaControl / ControlSystems.jl

A Control Systems Toolbox for Julia
https://juliacontrol.github.io/ControlSystems.jl/stable/
Other
509 stars 85 forks source link

zpkdata implementation flawed when considering discrete systems #13

Closed mfalt closed 8 years ago

mfalt commented 8 years ago

From @baggepinnen on February 27, 2016 9:47

The code below, is wrong, both for continuous and discrete systems

function _zpk_kern(s::SisoRational)
  return roots(s.num), roots(s.den), s.num[1]/s.den[1]
end

this fix works for continuous

function _zpk_kern(s::SisoRational)
  return roots(s.num), roots(s.den), s.num[end]/s.den[end]
end

but not for discrete, since SisoRational does not hold info regarding cont/discrete

Copied from original issue: mfalt/Control.jl#28

mfalt commented 8 years ago

From @baggepinnen on February 27, 2016 11:54

mostly fixed in pid branch

mfalt commented 8 years ago

How do you define the k in discrete time? I thought it would still be k*(z^n+b1z^{n-1}...bn)/(z^n+a1z^{n-1}...an).