how to solve equation of motion?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Respuestas (1)
Walter Roberson
el 11 de Oct. de 2017
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 comentario
Walter Roberson
el 11 de Oct. de 2017
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));
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!