How to delay a state derivative using ode solvers in MATLAB
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I would like to ask how it is possible to add a delay on the derivatives of the states that are being used inside a set of equations.
A simple random example to clarify what I mean:
function dz = example(t,z)
k = 2;l = 1;Is = 1;
x = z;
A = sin(x_dot)*l;
B = A*k;
x_dot = 1/Is*B;
dz = x_dot;
end
The above example in Simulink is quite simple to implement because we have the memory block to use for the x_dot. How could I implement the same in MATLAB? I thought of using a first order delay such as x_star_dot_dot = 1/tau*(-x_star_dot+x_dot), but I am not sure if this is the appropriate way to do it.
Many thanks
EDITED:
After Steven Lord's comment, here is a simple example of equations in which in order to find side slip angular velocity I need to know it beforehand.
5 个评论
Paul
2022-6-1
I'm curious about these equations. Usually, the equations of motions for an air vehicle do not exhibit an algebraic loop for the sideslip dynamics, at least to my undestanding. Would you mind providing a bit more insight into the source of these equations?
采纳的回答
更多回答(1 个)
Walter Roberson
2022-5-31
I just noticed that you intend to use this with the ode solvers.
The answer is that using this with the ode solvers would violate the mathematics used for predictions, and you would get the wrong result or error.
Using persistent cannot help you for this purpose, as your function is evaluated 6 times with different times and boundary conditions for each successful step, and the "previous" call might be for different conditions with different hypothesized derivatives.
What you need to do is use dde23 or similar.
10 个评论
Walter Roberson
2022-6-1
The memory/delay is to make the information into a state and use dde23 or equivalent.
If you have incoming information that you cannot characterize through its derivative then that would likely violate the conditions needed for Runge Kutta methods to work. dde23 has support for some cases of singularities that ode*() cannot handle.
Walter Roberson
2022-6-1
To be explicit, there is no available memory/delay mechanism for the ode* routines, and such a mechanism would be incompatible with the way ode*() routines calculate.
RK methods essentially do a polynomial fit at carefully selected locations near the current boundary. Those carefully selected locations do not have a "history" to go back to. They are not points that are expected to be gone to in the future: they are chosen to provide information about the local slope. Sort of like sweeping a flashlight in a regular pattern as you walk in the dark, you do not expect to travel through most of the points you light up, but you use the information to figure out the best route. (And every once in a while there is a tree in the way and you do end up going through the bramble bush as the best of not-great choices.)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!