Effacer les filtres
Effacer les filtres

How to plot a surface in 3D space from 4 points

26 vues (au cours des 30 derniers jours)
Katerina F
Katerina F le 7 Août 2017
Commenté : Adam le 9 Août 2017
Hello, I would like to plot a flat, vertical, surface in Matlab that is passing through the points A=(3.5,0,0), B=(0,8.59,0), C=(3.5,0,100), D=(0,8.59,100). Could you please help me with this? Thank you, K.

Réponse acceptée

KSSV
KSSV le 7 Août 2017
Modifié(e) : KSSV le 8 Août 2017
A=[3.5,0,0] ;
B=[0,8.59,0] ;
C =[3.5,0,100] ;
D = [0,8.59,100] ;
coor = [A ; B; D; C ] ;
fill3(coor(:,1),coor(:,2),coor(:,3),'r', 'FaceAlpha', 0.5)
  4 commentaires
Jan
Jan le 8 Août 2017
This works fine under R2016b:
fill3(coor(:,1),coor(:,2),coor(:,3),'r', 'FaceAlpha', 0.5)
Please explain, what "does not work" mean.
Katerina F
Katerina F le 8 Août 2017
Thanks. It works. Probably I was applying it in a wrong way and it was showing me an error.

Connectez-vous pour commenter.

Plus de réponses (1)

John BG
John BG le 7 Août 2017
Hi Katerina
while
A=[3.5,0,0]
B=[0,8.59,0]
C=[3.5,0,100]
D=[0,8.59,100]
P=[A;B;C;D]
X=P(:,1);Y=P(:,2);Z=P(:,3);
h1=patch('XData',X,'YData',Y,'ZData',Z,'EdgeColor','green','FaceColor',[.2 .8 .2],'LineWidth',2)
.
delivers a bow tie .
.
if you swap points order, B with A .
P=[B;A;C;D]
.
.
then one gets the sought flat vertical surface.
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG
  3 commentaires
John BG
John BG le 8 Août 2017
so what was the comment?
Adam
Adam le 9 Août 2017
It is in bold in my comment.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Performance dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by