how to solve equation of motion?
2 次查看(过去 30 天)
显示 更早的评论
I have a problem with solving the equation of motion for a dinamic flow inside a square 0<q<2 0<p<2 in which i have dq/dt=2 dp/dt=r (r variable integer not time depending). How can I apply periodic boundary condition to this problem?
回答(1 个)
Walter Roberson
2017-10-11
Use event functions with ode45() or similar. The event functions should detect the boundary and halt the integration, and you would then restart the integration with the altered conditions. For example, you might check and find that q had reached 2, and then you would call ode45() again with the same dq/dt but the negative of the current dp/dt (for example)
You have not been clear as to how you want the periodic conditions to behave? Reverse the horizontal velocity? "bounce" using "angle of incidence = angle of reflection" ? Teleport to the other side of the box?
1 个评论
Walter Roberson
2017-10-11
Still not enough information about what is to happen at the boundaries.
You said that r is an integer? The integral of a constant with respect to time is just the constant multiplied by the time, so if the periodic conditions are to just disappear from one side and reappear on the other, your conditions become equivalent to
q = mod(2 * t, 2)
p = mod(r * t, 2)
which is not ergotic for rational r. For integer r, the (q,p) pairs have a period of lcm(2, r) where lcm is lowest common multiple.
q = @(t) mod(2*t,2), p = @(t) mod(17*t,2);
t = linspace(0,500,1000);
scatter(q(t), p(t));
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!