How to plot vectors as 3D plot
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So i have a platform and a base. The platform has the following points B1= (15 15 0) B2= (-15 15 0) B3= (-15 -15 0) B4= (15 -15 0) And it's moving so i put those points in an equation with respect to some angles so it becomes b1 = P + (R*B1) b2 = P + (R*B2) b3 = P + (R*B3) b4 = P + (R*B4) Where P is [0 0 20] and R is a rotation matrix with respect to some angles And the base has the corresponding points A1 = (5 14 0) A2= (-30 30 0) A3= (-30 -30 0) A4= (5 -14 0)
How do i plot bi and Ai such that the base is connected with the platform with a line between the point in the platform with the corresponding one in the base ?
0 commentaires
Réponses (1)
KSSV
le 5 Avr 2016
Are you expecting something like this?
clc; clear all ;
% Platform
B = [15 15 0 ;
-15 15 0 ;
-15 -15 0 ;
15 -15 0] ;
P = [0 0 20] ;
P = repmat(P,[4,1]) ;
% A random rotation
R = rand(1,3) ;
R = repmat(R,[4,1]) ;
%
b1 = P + (R.*B) ;
% Base
A = [5 14 0 ;
-30 30 0 ;
-30 -30 0 ;
5 -14 0] ;
my_vertices = [A ; b1] ;
my_faces = [1 2 3 4; 2 6 7 3; 4 3 7 8; 1 5 8 4; 1 2 6 5; 5 6 7 8];
patch('Vertices', my_vertices, 'Faces', my_faces, 'FaceColor', 'w');
2 commentaires
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!