Plotting arrows specified by azimuth

3 visualizaciones (últimos 30 días)
John
John el 21 de Jun. de 2011
I am trying to construct a "tadpole" plot which illustrates a vector specified by its azimuth measured clockwise from north. Here is some code that does the task:
xpos=unifrnd(0,10,15,1); % X location
ypos=unifrnd(0,10,15,1); % Y location
azi=unifrnd(0,360,15,1); % Vector azimuth (north = 0)
Ecpt=sin(azi*pi/180); % East component of vector
Ncpt=cos(azi*pi/180); % North component of vector
quiver(xpos,ypos,Ecpt,Ncpt)
The problem I'm encountering, however, is that if I rescale the plot axes (by zooming in for example), the orientation of the vector changes. You can see this in the case that the horizontal axis is stretched:
p=axis;
axis([p(1) p(2)*5 p(3) p(4)]);
How could I specify the vectors so that (for example) a vector corresponding to an azimuth of 70 deg. always appears in the plot at a 20 deg. angle to the horizontal axis no matter how I change the axes or zoom in?

Respuestas (1)

Patrick Kalita
Patrick Kalita el 21 de Jun. de 2011
I think in order to keep the angles consistent you can't necessarily change the axes limits completely arbitrarily, because the quiver arrows are essentially static once they are drawn in an axes. They don't dynamically update with changes to the limits.
Your best bet here might be to use axis equal.
  1 comentario
John
John el 21 de Jun. de 2011
Thanks, Patricia.
I should have mentioned in my posting that the x-y axes can't easily be scaled using 'axis equal', unfortunately (x is in degrees from 0-90, and y is in meters). I'm going to keep working on this problem and will update the posting if I have a break-through!
Thanks again,
John.

Iniciar sesión para comentar.

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by