How can I extract orientation of arrows from quiver function?
Mostrar comentarios más antiguos
In quiver function where is the information about the arrow orientation?
Respuestas (2)
Sean de Wolski
el 10 de Mzo. de 2015
Editada: Sean de Wolski
el 10 de Mzo. de 2015
You'll need to use atan2 to get the orientation from u, v
q = quiver(1,1,1,0.5)
r = atan2(q.VData,q.UData)
r*180/pi to get it into degrees
Michael Haderlein
el 9 de Mzo. de 2015
quiver actually plots the information.
quiver(x,y,u,v)
means arrows are drawn pointing in (u/v) direction and positioned at (x/y). So, if you have x=0, y=0, u=1, v=1, you get one arrow pointing top right. For multiple arrows, x, y, u and v have multiple values.
5 comentarios
annalisa08
el 10 de Mzo. de 2015
annalisa08
el 10 de Mzo. de 2015
Michael Haderlein
el 10 de Mzo. de 2015
What do you mean, the orientation is different? It should be the same. You can prove it:
>> x=zeros(10,1);y=zeros(10,1);u=rand(10,1);v=rand(10,1);
>> compass(u,v)
>> axes
>> quiver(x,y,u,v,1,'color','r')
>> set(gca,'color','none')
Then select the arrow in the figure toolbar and match the origin of both axes and the scales as well (so (1/0) matches with r=1, angle=0 and (0/1) matches with r=1, angle=90°). You'll see that the arrows match perfectly. If you do not consider the scaling (that's the 1 in the quiver command), the length of the arrows differ. The orientation remains the same.
annalisa08
el 10 de Mzo. de 2015
Michael Haderlein
el 10 de Mzo. de 2015
I don't get it... The origin is lost in the compass plot, but that's an inherent property of the compass plot and has nothing to do with the orientation. Set all x,y to zero and the arrows will align. Set x,y to their correct values (~=0) and they will shift to their correct position but remain their orientation.
Categorías
Más información sobre Vector Fields en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!