How to get back data from quiver function?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Yuvarajendra Anjaneya Reddy
le 8 Jan 2023
Commenté : Yuvarajendra Anjaneya Reddy
le 10 Jan 2023
Let's say I create a quiver plot with X, Y, U and V. If we think in the sense of particles, consider 'n' number of particles that particles have location [X,Y] and corresponding velocities [U, V]. The result from using 'quiver' function is, I get a vector plot that has vectors indicating direction and magnitude of particle displacement. This means that the particles have new locations [X1, Y1]. Is there a way to get this new location data?
I have checked the "get(hQ, 'Xdata')", function that gets me the original data that I have provided to the 'quiver' function, but I could not find the updated location data as inferred from the quiver plots.
I also, understand that scaling the arrows can have an impact on the new locations [X1, Y1]. But, that can not be a concern as of now. Any help is appreciated. Thanks in advance.
0 commentaires
Réponse acceptée
Adam Danz
le 8 Jan 2023
Modifié(e) : Adam Danz
le 8 Jan 2023
> the particles have new locations [X1, Y1]. Is there a way to get this new location data?
If you already have the X, Y, U and V values, then the new location is
xnew = x+u;
ynew = y+v;
N.B. These coordinates will match the location of quiver arrow heads only when scaling is turned off.
Examples:
x = rand(1,20)*20 - 10;
y = rand(1,20)*10 + 40;
u = rand(1,20)*6 - 3;
v = rand(1,20)*10 - 5;
quiver(x,y,u,v,'off')
x1 = x + u;
y1 = y + v;
hold on
plot(x, y, 'bo') % mark arrow tail
plot(x1, y1, 'rs') % mark arrow head
5 commentaires
Adam Danz
le 9 Jan 2023
In quiver(x,y,u,v), u and v are the horizontal and vertical components of the vector that starts at (x,y). You can use any units for u and v as long as they are consistent between u and v. For example, u and v could represent pressure or miles-per-3-hours instead of mph. Your choice of units affects how you interpret the magnitude (or length) of the resultant vector which shares the same units as U and V.
Plus de réponses (1)
MJFcoNaN
le 8 Jan 2023
Hello,
The vector field is instantaneous, therefore, you have to provide the increment of time for getting a new proximate location. Or you can calculate it from a time series of vector fields.
Voir également
Catégories
En savoir plus sur Vector Fields dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!