在两个彼此平行的点上绘制两个向量

时间:2016-04-12 08:20:25

标签: matlab math multidimensional-array graph graphics

考虑一个向量,A = [0.13,0.98,0.05]

如何绘制矢量,B与A平行但在点处 P = [155,156,52],是载体B的起源。

我在MATLAB中尝试如下,

pts = [O; A]; %   O= [0 0 0]
line(pts(:,1), pts(:,2), pts(:,3))

B = A*10; % Multiplied B by any scalar (e.g. 10) to get a vector parallel to A  
hold on
pts = [P; B]; % PB vector parallel to OA
line(pts(:,1), pts(:,2), pts(:,3))
你能纠正我吗?

%******************更多解释********

         E = cross(B,C); 

所以三个向量(B,E,C)需要在P点绘制。我完全被困在这里

1 个答案:

答案 0 :(得分:0)

你有第一个线段和矢量点(它定义了段的方向和它的长度)。

要获得第二个点,您必须将向量添加到第一个点:

pts = [P; P + B];
for your data
P = [155, 156, 52]
B =  [1.3, 9.8, 0.5]
P + B = [156.3, 165.8, 52.5]

Vector / Point算术的一些规则:

Vector = Point - Point
there is no point addition operation
Point = Point +/- Vector
Vector = Vector +/- Vector
Vector = Scalar * Vector
//more complex rules for multiplication