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
+9-10Lines changed: 9 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ k = ShiftIndex(clock)
39
39
40
40
eqs = [
41
41
x(k) ~ 0.5x(k - 1) + u(k - 1),
42
-
y(k) ~ x(k - 1)
42
+
y ~ x
43
43
]
44
44
```
45
45
@@ -49,13 +49,13 @@ A few things to note in this basic example:
49
49
-`x` and `u` are automatically inferred to be discrete-time variables, since they appear in an equation with a discrete-time [`ShiftIndex`](@ref)`k`.
50
50
-`y` is also automatically inferred to be a discrete-time-time variable, since it appears in an equation with another discrete-time variable `x`. `x,u,y` all belong to the same discrete-time partition, i.e., they are all updated at the same *instantaneous point in time* at which the clock ticks.
51
51
- The equation `y ~ x` does not use any shift index, this is equivalent to `y(k) ~ x(k)`, i.e., discrete-time variables without shift index are assumed to refer to the variable at the current time step.
52
-
- The equation `x(k) ~ 0.5x(k-1) + u(k-1)` indicates how `x` is updated, i.e., what the value of `x` will be at the *current* time step in terms of the *past* value. The output `y`, is given by the value of `x` at the *past* time step, i.e., `y(k) ~ x(k-1)`. If this logic was implemented in an imperative programming style, the logic would thus be
52
+
- The equation `x(k) ~ 0.5x(k-1) + u(k-1)` indicates how `x` is updated, i.e., what the value of `x` will be at the *current* time step in terms of the *past* value. The output `y`, is given by the value of `x` at the *current* time step, i.e., `y(k) ~ x(k)`. If this logic was implemented in an imperative programming style, the logic would thus be
53
53
54
54
```julia
55
55
functiondiscrete_step(x, u)
56
-
y = x # y is assigned the current value of x, y(k) = x(k-1)
57
56
x =0.5x + u # x is updated to a new value, i.e., x(k) is computed
58
-
return x, y # The state x now refers to x at the current time step, x(k), while y refers to x at the past time step, y(k) = x(k-1)
57
+
y = x # y is assigned the current value of x, y(k) = x(k)
58
+
return x, y # The state x now refers to x at the current time step, x(k), and y equals x, y(k) = x(k)
59
59
end
60
60
```
61
61
@@ -68,22 +68,21 @@ eqs = [
68
68
]
69
69
```
70
70
71
-
but the use of positive time shifts is not yet supported.
72
-
Instead, we have *shifted all indices* by `-1`, resulting in exactly the same difference equations. However, the next system is *not equivalent* to the previous one:
71
+
but the use of positive time shifts is not yet supported. Instead, we *shifted all indices* by `-1` above, resulting in exactly the same difference equations. However, the next system is *not equivalent* to the previous one:
73
72
74
73
```@example clocks
75
74
eqs = [
76
-
x(k) ~ 0.5x(k - 1) + u(k - 1),
75
+
x(k) ~ 0.5x(k - 1) + u(k),
77
76
y ~ x
78
77
]
79
78
```
80
79
81
-
In this last example, `y` refers to the updated `x(k)`, i.e., this system is equivalent to
80
+
In this last example, `u(k)` refers to the input at the new time point `k`., this system is equivalent to
0 commit comments