-
-
Notifications
You must be signed in to change notification settings - Fork 224
add docs for sampled-data systems #2410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
docs/src/tutorials/SampledData.md
Outdated
function discrete_step(x, u) | ||
y = x # y is assigned the old value of x | ||
x = 0.5x + u # x is updated to a new value | ||
return x, y # The state x now refers to x at the next time step, while y refers to x at the current time step | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this make y
lag x
by one timestep? This would then imply that y(k+1) ~ x(k)
which is not what the equation above says.
Basically, if x, y, u = [1.0, 1.0, 2.0]
would the timeseries be[[1.0, 1.0, 2.0], [2.5, 1.0, 2.0], [3.75, 2.5, 2.0]]
or [[1.0, 1.0, 2.0], [2.5, 2.5, 2.0], [3.75, 3.75, 2.0]]
I'm not very familiar with discrete-time modeling, so this may be some common misunderstanding I'm unaware of 😅
EDIT: If there's some tutorial/book for these kind of models I can go through that would be helpful, since the below examples also don't quite make sense to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this make y lag x by one timestep?
Yes, the output x
of this function is one step ahead of the output y
, but y(k)
does not lag x(k)
. Note how the comment mentions
The state x now refers to x at the next time step, while y refers to x at the current time step
Where next in x at the next time step
is key. The returned value of the manually implemented function discrete_step
is thus to be interpreted as the tuple
(state in next time step, current time output)
I'll commit a change to the comment to hopefully make this more clear
My goto book is usually "Computer-controlled systems" by KJ Åström, but I'm not sure if it would be particularly useful as a reference here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this commit clarifies further? cbd9f59
@baggepinnen can something of this form be merged by the end of the day? It can continue to improve but we need something to go with the v9. |
This documents functionality that is not yet existing, in particular, the user interface for simulation is almost 100% missing and the MTK compiler is broken, JuliaSimCompiler is required, so I'd rather not merge any of it yet. |
Okay then we'll v9 without this. |
Build failed. |
Work in progress