You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following construct is equivalent to delaying a signal by 2 samples. but the result is that the output is constantly zero. The expected output is a step from 0 to 1 at t=4.
delay(k) ~ input(k - 1)
Hold(delay(k-1))
using ModelingToolkit: t_nounits as t, D_nounits as D
k =ShiftIndex(Clock(t, 1))
@mtkmodel DelayModel begin@variablesbegininput(t) =0delay(t) =0x(t) =0end@equationsbegin
input ~ (t >=2)
delay(k) ~input(k -1)
D(x) ~ (-x +Hold(delay(k-1))) /1e-3endend@mtkbuild m =DelayModel()
prob =ODEProblem(
m, [m.delay(k -3) =>0, m.delay(k -2) =>0, m.delay(k -1) =>0], (0.0, 10.0))
sol =solve(prob, Tsit5(), kwargshandle = KeywordArgSilent, dtmax =0.5)
plot(sol, idxs=m.x)
The text was updated successfully, but these errors were encountered:
The following construct is equivalent to delaying a signal by 2 samples. but the result is that the output is constantly zero. The expected output is a step from 0 to 1 at t=4.
The text was updated successfully, but these errors were encountered: