plot 2 3D vectors in Matlab
31 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear all,
I have these vectors
a = [1 2 -3];
b = [-3 12 -13];
Both start from c=[0 0 0];
How can I plot them in a 3D envirorment?
Can you provide with a sample code?
0 comentarios
Respuestas (1)
Fabio Freschi
el 21 de Feb. de 2020
% vectors
a = [1 2 -3];
b = [-3 12 -13];
% starting point
C0 = [0 0 0];
% put vector in a matrix, to make the code more flexible (e.g. more vectors)
V = [a; b];
% replicate the starting point for all vectors
C = repmat(C0,size(V,1),1);
% plot
figure, hold on
quiver3(C(:,1),C(:,2),C(:,3),V(:,1),V(:,2),V(:,3))
% change point of view
view([1 1 1])
0 comentarios
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!