I want to Plot a triangle using points p, q ,and r. Also, I need to show vectors PQ and PR starting from p and their cross product vector V

2 次查看(过去 30 天)
They want me to use Plot3 in order to do this, but I keep getting stuck and confused and can't find a similar problem online.
the points I was given are:
p = [15,20,14];
q = [19,21,9];
r = [16,19,11];
PQ = [4,1,-5]
PR = [1,-1,3]
angle between PQ and PR = 33.1297
Cross product of PQ x PR = (-2,-17,-5)

回答(2 个)

Fabio Freschi
Fabio Freschi 2019-9-26
p = [15,20,14];
q = [19,21,9];
r = [16,19,11];
% open figure and setup view
figure, hold on
view([1 1 1]);
% plot vertices
plot3([p(1); q(1); r(1)],[p(2); q(2); r(2)],[p(3); q(3); r(3)],'o');
% edge PQ
PQ = q-p;
quiver3(p(1),p(2),p(3),PQ(1),PQ(2),PQ(3),0);
% edge PR
PR = r-p;
quiver3(p(1),p(2),p(3),PR(1),PR(2),PR(3),0);
% cross product
PQxPR = cross(PQ,PR);
quiver3(p(1),p(2),p(3),PQxPR(1),PQxPR(2),PQxPR(3),0);
  1 个评论
Peter Pyrka
Peter Pyrka 2019-9-27
Thank you ! I am curious about two things still. Is the triangle supposed to be connected by point from r to q also? Because on my screen it only shows the vectors PR and PQ from point P and the cross product. Also, how would I find the equation of the plane containing point p,q , and r?triangle t.PNG

请先登录,再进行评论。


Fabio Freschi
Fabio Freschi 2019-9-27
Replace the first plot with
% plot vertices
plot3([p(1); q(1); r(1); p(1)],[p(2); q(2); r(2); p(2)],[p(3); q(3); r(3); p(3)],'-o');
Concerning the plane equation, you can google "plane passing for three points".+
If my answer solves your problem, please accept it

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by