Question about velocity graphs with quiver3

3 views (last 30 days)
Hey, Im trying to use quiver3 to plot some vectors and it wont start at the right position! I dont want the vector to start at the origin, I want it to start at my data points and point TOWARDS the origin. Heres what I have...
figure(1)
quiver3(100,150,-500,0,0,0,'r')
xlim([-200 200]);
ylim([-200 200]);
zlim([-1000 0]);
drawnow
Now when I reverse the 0s so they are in the front, it works fine except for it points from the origin to my point. I want it the other way around! When I have the points first, nothing appears. Please help thanks!

Accepted Answer

JP
JP on 24 Jun 2013
Ahh I actually just figured it out. I was being an idiot. For quiver3, it species the first three numbers are the point at which you want your vector, and the second three numbers are the vector you want drawn. For some reason I thought the length of the vector depended on the difference between the two sets of points, but that is not the case! So if you want a vector of [1;2;3] at point (2,3,5) you do
quiver3(2,3,5,1,2,3)
sorry, hope this helps if anyone makes the same dumb mistake I did
  1 Comment
Ashbub
Ashbub on 7 Jan 2018
Hi, if I want to draw numerous vectors using quiver3(0,0,0,x(:),y(:),z(:)), where x, y and z stores the vector coordinates. Its giving error message
"Error in regionpropstrials (line 18) quiver3(0,0,0,x(:),y(:),z(:));"
Please suggest.

Sign in to comment.

More Answers (1)

David Sanchez
David Sanchez on 24 Jun 2013
Did you read the help?
help quiver3
with your code, you are setting the velocities to 0, no doubt you do not get anything. The 4th, 5th and 6th elements have to be the velocities, if you set them to 0, nothing shows up.
This may be of help:
quiver3(100,150,-500,-100,-150,500)
hold on
plot3(100,150,-500,'*', 'MarkerSize',10)
plot3(0,0,0,'r*', 'MarkerSize',10)
hold off
  1 Comment
JP
JP on 24 Jun 2013
Yes I answered my own question a while ago thanky anyways, sorry!

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!