quiver3 not plotting the end point

I used the quiver3 function and was specting a vector that goes from 0,2,4 to 2,7,10. To confirm this I plotted both points but only the point 0,2,4 matches the origin of the vector, the point 2,7,10 doesn't quite match with the end of the vector. Can someone help me with this problem? Is it just a matter of positioning or what am I doing wrong?
Thanks in advance (and well sorry I kind of plotted 2 vectors the second one being from 0,2,4 to 2,4,6)
This is my code
quiver3(0,2,4,2,5,6)
axis([-10 10 -10 10 -10 10])
hold on
plot3(0,2,4,'+')
plot3(0+2,2+5,4+6,'+')
quiver3(0,2,4,2,2,2)
plot3(2,4,6,'+')
And this is the corresponding output

 Accepted Answer

I dont find any issue, please dont mixed up with the quiver and plot3, see your example
quiver3(0,2,4,2,5,7);
hold on;
quiver3(0,2,4,2,2,2);
axis([-10 10 -10 10 -10 10])
In both quiver plot case, draw the vecor with the components at given points. here first three digit represents the one co-ordinates (Draw the vector here), as plot is 3-D, hence you have to defined the three points (x,y,z), 2nd part with vector components. See First co-ordinates are same for both case, as it the co-ordinates for vecor origion, hence it starting the same points (initial points)
Same code
quiver3(x1,y1,z1,x2,y2,z2);
Now plot vector with components x2,y2,z2 at x1,y1,z1
Hope I get your question, if not let me know please!

3 Comments

Thanks so much for your reply!
Ok I'm sorry I think I didn't make myself clear
This is the code for this new figure
quiver3(0,2,4,2,5,6)
hold on
plot3(0,2,4,'*')
plot3(2,7,10,'*')
So what I don't understand is why does the vector of quiver3 function doesn't match the end point (2,7,10) since when I use quiver3(0,2,4,2,5,6) I'm plotting a vector that goes from the point (0,2,4) to the point (0,2,4)+(2,5,6) = (2,7,10). And if I'm wrong in assuming that and the vector of quiver3 actually goes to the point (2,5,6) instead, the quiver3 vector doesn't match the point (2,5,6) either.
In the code having 3 plots:
Concept: quiver3(x,y,z,u,v,w) plots vectors with components (u,v,w) at the points (x,y,z)
First One:
quiver3(0,2,4,2,5,6)
Here in the figure vector with the components (2,5,6) at the point (0,2,4), which is reflectedin the figure
2nd Plot, Just a point (0,2,4) in 3d space, which is reflected, I have change the color for better visualizations
plot3(0,2,4,'ro','linewidth',2);
3rd Plot, Just an another point (2,7,10) in 3d space, which is reflected, I have change the color for better visualizations
plot3(2,7,10,'b*','linewidth',2);
And please note that the quiver start point and 2nd point having same co-ordinates, which is same reflected in the figure.
TLDR
I'm sorry I'm new to quiver3 and didn't read the documentation...
the problem gets fixed with the command
quiver3(0,2,4,2,5,6,0) %ADD THE SCALING FACTOR
hold on
plot3(0,2,4,'*')
plot3(2,7,10,'*')
Big thanks to KALYAN ACHARJYA for his patience, his help and making me realize you can only have the origin of the vector fixed when you don't add the scale option in quiver3

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!