Is it possible to plot a vector arrow using quiver( ), then, negate the vector so it points in the opposite direction, but then add arrowhead in original direction?
Ältere Kommentare anzeigen
Hi there!
This is somewhat embarassing, but I've been trying this little thing for a while now, so I figured it's a good time to ask now:
I would like to plot a velocity vector, e.g. representing a fluid flow, pointing at / acting on an object (let's say, a thin rectangle).
But if I use quiver( ) to plot the vector, the vector would emanate from the object, and consequently point away from the object, not towards it.
So, my little hack was this:
- Plot the vector using quiver; it'll emanate from the object and point away from the object;
- Negate the vector, so it emanates from the object, but now it points in the opposite direction; and
- Remove the arrowahead from the vector.
Removing the arrowhead from the vector makes the line potentially look like it's pointing toward the object, which is what I want.
But now, here's the hard part, Matlab doesn't appear to be able to add an arrowhead, so that the vector can point in the original direction, which is what I want, so that the vector looks like it's pointing at the object. Matlab appears to be able to only add an arrowhead in the direction that the vector values indicate.
Basically, how can I add an arrowhead at the tail of the vector, but have it point in the opposite direction?
Is there a better alternative?
Thanks in advance,
1 Kommentar
dpb
am 23 Dez. 2024
As always, it would be helpful if you would attach enough code/data to give us a working starting-off point...
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Vector Fields finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



