本文介绍了如何在MATLAB中绘制矢量(物理2D/3D矢量)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在 MATLAB 中绘制矢量的最简单方法.例如:

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?

推荐答案

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

这篇关于如何在MATLAB中绘制矢量(物理2D/3D矢量)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-24 06:39