Plotting arrows specified by azimuth
3 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Patrick Kalita
on 21 Jun 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.
See Also
Categories
Find more on Vector Fields in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!