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
Copy file name to clipboardExpand all lines: docs/src/tutorials/SampledData.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,10 @@ The operators [`Sample`](@ref) and [`Hold`](@ref) are thus providing the interfa
25
25
The [`ShiftIndex`](@ref) operator is used to refer to past and future values of discrete-time variables. The example below illustrates its use, implementing the discrete-time system
var isa Equation &&returnsimplify_shifts(var.lhs) ~simplify_shifts(var.rhs)
@@ -518,3 +524,45 @@ function simplify_shifts(var)
518
524
unwrap(var).metadata)
519
525
end
520
526
end
527
+
528
+
"""
529
+
Distribute a shift applied to a whole expression or equation.
530
+
Shift(t, 1)(x + y) will become Shift(t, 1)(x) + Shift(t, 1)(y).
531
+
Only shifts variables whose independent variable is the same t that appears in the Shift (i.e. constants, time-independent parameters, etc. do not get shifted).
532
+
"""
533
+
functiondistribute_shift(var)
534
+
var =unwrap(var)
535
+
var isa Equation &&returndistribute_shift(var.lhs) ~distribute_shift(var.rhs)
0 commit comments