Closed fibonatic closed 11 months ago
This appears to work for me
julia> G = tf(1.0, [1, 1])
TransferFunction{Continuous, ControlSystemsBase.SisoRational{Float64}}
1.0
----------
1.0s + 1.0
Continuous-time transfer function model
julia> c2d(G, 0.1, :zoh)
TransferFunction{Discrete{Float64}, ControlSystemsBase.SisoRational{Float64}}
0.09516258196404037
-------------------------
1.0z - 0.9048374180359594
Sample Time: 0.1 (seconds)
Discrete-time transfer function model
Are you trying to use method
as a keyword argument? It's a regular positional argument.
On a side note, are you the user handle fibonatic
on the control discord? If so, we spoke about coherence functions this morning ;)
Yes, I am currently busy writing some test code, but it has been a while since I used Julia. And I was indeed using method=:zoh
as input argument. Without the method=
it is indeed working OK.
Thanks!
You might have been confused by the fact that the method
argument hasa default value indicated by the signature in the docstring
sysd = c2d(sys::AbstractStateSpace{<:Continuous}, Ts, method=:zoh; w_prewarp=0)
Gd = c2d(G::TransferFunction{<:Continuous}, Ts, method=:zoh)
Note the difference between the two method signatures, the ;
denotes the delimitation between positional arguments and keyword arguments.
When I attempt to specify which discretization method I want to use, for example:
Gd = c2d(G::TransferFunction{<:Continuous}, Ts, method=:zoh)
I get the error:c2d_x0map(::AbstractStateSpace{<:Continuous}, ::Real) got unsupported keyword argument "method"
I am using Julia 1.9.3 and just installed ControlSystems.jl today. I also get the same error in Julia 1.8.5