Quiver plots using data from a loop
5 views (last 30 days)
Show older comments
I hope someone can help me with the following quiver mysterious.
I would like to plot velocity vectors as arrows with components (u,v) at the points (x,y). However, from the whole set of data, I would like to display only every certain x values (vertical lines) as in figure 1. I use a loop to obtain only the data that I would like to plot (i.e. every 140 values). Since I would like to use these specific data as matrix, I create X,Y,U,V. When I plot quiver of X,Y,U,V the plots are different. In particular,it seems one line starts differently than the next one (beginning of the grid columns)
I have tried using structures and I get the same. I check the matrix X,Y,U and V and they are the sames than by using the loop. Therefore I cannot understand why I dont get the same plot.
Could anyone explain me the reason?
Thanks
Thanks a lot in advance
------------------------------------ m1=1;
for k=1:140:length(x(1,:))
xp=x(:,k);
yp=y(:,k);
up=u(:,k);
vp=v(:,k);
X(:,m1)=xp;
Y(:,m1)=yp;
U(:,m1)=up;
V(:,m1)=vp;
figure(1)
h3=quiver(xp(1:15:end),yp(1:15:end),up(1:15:end),vp(1:15:end),1);
hold on
axis([0 600 0 70])
m1=m1+1;
end
figure(2)
h4=quiver(X(1:15:end),Y(1:15:end), U(1:15:end),V(1:15:end),1);
axis([0 600 0 70])
Figure 1:
Figure 2:
2 Comments
Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!