Векторы не появляются внутри плоскости, потому что вы выбираете (0,0,0)
в качестве начальной точки векторов, когда вы проходите плоскость мимо случайно выбранной точки p
.
Вы либо заставляете плоскость проходить мимо (0,0,0)
, либо используете p
в качестве начальной точки для векторов при нанесении с помощью quiver3()
.
Вот решение, в котором я выбрал второй вариант:
vplane = [1 3 0; 2 4 0]'; % (column) vectors defining the plane
vnormal = cross(vplane(:,1), vplane(:,2)); % normal defining the orientation of the plane
figure; hold on; grid on; view(45, 45);
rng(1313) % seed for reproducible output
p = 10*(rand(3,1) - 0.5); % a point defining the position of the plane we want to plot with the given normal vector
P = repmat(p, 1, 2); % matrix with the given point repeated for easier use of quiver3()
quiver3(P(1,:), P(2,:), P(3,:), vplane(1,:), vplane(2,:), vplane(3,:), 0); % arrows representing the vectors defining the plane
[x,y] = meshgrid( p(1)+(-5:5), p(2)+(-5:5) ); % set of equally spaced points inside the plane
z = p(3) - (vnormal(1)*(x-p(1)) + vnormal(2)*(y-p(2))) / vnormal(3); % plane equation
surf(x,y,z) % plot the plane
и результат следующий:
![enter image description here](https://i.stack.imgur.com/P7f2t.png)