Here’s the corresponding one for statespace systems
using LinearAlgebra
function d2dc(sys::AbstractStateSpace{<:Discrete})
T = sys.Ts
A,B,C,D = ssdata(sys)
z = delay(-T)
LR = append([z for _ in 1:sys.nx]...) - ss(A + I)
C * feedback(I(sys.nx), LR)*B + D
end
sys = ssrand(2, 3, 2, Ts = 1) # A random discrete-time MIMO system
sysc = d2dc(sys)
bodeplot(sys, w, lab="Discrete SS")
bodeplot!(sysc, w, lab="Continuous SS with delays", l=:dash, size=(800, 800))
Cool, thanks for the detail! I was considering asking what your application was that required such precision in the frequency response close to the Nyquist frequency.