Algorithm to calculate trajectories from a vector field
30 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear altruists,
Suppose, I have a two-dimensional vector field, i.e., for each point (x, y) I have a vector (u, v), whereas u and v are functions of x and y.
This vector field canonically defines a set of trajectories, i.e. a set of paths a particle would take if it follows along the vector field. In the following image, the vector field is depicted in blue, and there are four trajectories (which are my expected outcome), depicted in dark red:
I am looking for an algorithm which will give me a trajectory of a virtual particle I imagine from anypoint of that vector field. The trajectories must satisfy some kind of minimum denseness in the plane (for every point in the plane we must have a 'nearby' trajectory), or some other condition to get a reasonable set of trajectories.
I could not find anything useful on Google on this, so I posted it here because I always get responses from this community :)
Before I start devising such an algorithm by myself: Are there any known algorithms for this problem? What is their name, for which keywords do I have to search?
0 Commenti
Risposta accettata
Jon
il 10 Gen 2022
Modificato: Jon
il 10 Gen 2022
The trajectories you are seeking are solutions to a set of ordinary differential equations with initial conditions given by the starting point of the particle. You can solve ode's using MATLAB ode solvers see https://www.mathworks.com/help/matlab/ordinary-differential-equations.html
These functions will solve a system of ode's dx/dt = f(x). Since these functions only a require that you create a function that gives the derivatives (dx/dt) as a function of the system state (x). The same fuction that you are using to generate your vector fields can be used to provide the needed derivatives at a given state values. If your vector fields are from experimental data, you could probably use the data you have and some interpolation to calculate the derivatives needed for the ode solver.
15 Commenti
Jon
il 26 Gen 2022
The rows in p are the time steps, the columns are the x and y positions. So I guess you understand why it had two columns. Regarding the number of rows, being 41, I this corresponds to the number of time steps the algorithm takes to go from 0 to tspan. The ode45 solver is a variable step size solver, so you don't have direct control of how many steps it takes. It depends upon the vector field and also the options for the error tolerances.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!