How to draw vectors (physical 2D/3D vectors) in MATLAB?
Date: 2023-03-17 14:32:27
I want to know the simplest way to plot vectors in MATLAB. For example:
a = [2 3 5];
b = [1 1 0];
c = a + b;
I want to visualize this vector addition as head-to-tail/parallelogram method. How do I plot these vectors with an arrow-head?
Answers:
a = [2 3 5];
b = [1 1 0];
c = a+b;
starts = zeros(3,3);
ends = [a;b;c];
quiver3(starts(:,1), starts(:,2), starts(:,3), ends(:,1), ends(:,2), ends(:,3))
axis equal