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 views (last 30 days)
Show older comments
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)
0 Comments
Answers (2)
Fabio Freschi
on 26 Sep 2019
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);
Fabio Freschi
on 27 Sep 2019
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
0 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!