How to rotate a quiver object in matlab
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ricardo Ferreira
am 9 Jun. 2015
Kommentiert: Adam Danz
am 16 Apr. 2020
I have a quiver object like this
q = quiver(x,y,u,v);
and then I use rotate to rotate it, but nothing happens
rotate(q,[0 0 1],180);
the command above works on a surf object, but not in a quiver one,why?
Thank you!
1 Kommentar
Adam Danz
am 16 Apr. 2020
If you're rotating the vector about it's base so that (x,y) do not change but the direction of the vector changes, you can use quiverRotate() from the file exchange.
Example:
[Ur, Vr] = quiverRotate(U, V, 180, 'deg');
quiver(x, y, Ur, Vr)
% Or use the quiver handle
quiverRotate(q, 180, 'deg')
Akzeptierte Antwort
Mike Garrity
am 9 Jun. 2015
The rotate command actually modifies the data of the graphics object, and it doesn't know how to modify all of the different types of graphics objects. The quiver one, in particular is a bit tricky because some of the data represents directions instead of positions.
g = hgtransform;
quiver(x,y,u,v,'Parent',g)
set(g,'Matrix',makehgtform('zrotate',pi/4))
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Vector Fields finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!