quiver3 not plotting the end point

34 views (last 30 days)
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

KALYAN ACHARJYA
KALYAN ACHARJYA on 16 Aug 2020
Edited: KALYAN ACHARJYA on 16 Aug 2020
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
KALYAN ACHARJYA
KALYAN ACHARJYA on 16 Aug 2020
Edited: KALYAN ACHARJYA on 16 Aug 2020
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.
Kevin Cardenas
Kevin Cardenas on 16 Aug 2020
Edited: Kevin Cardenas on 16 Aug 2020
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)

Categories

Find more on Vector Fields 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!