Courbes 3D sur Matlab

Réponses à toutes vos questions après le Bac (Fac, Prépa, etc.)
ericsteph
Membre Naturel
Messages: 96
Enregistré le: 05 Oct 2007, 21:46

Courbes 3D sur Matlab

par ericsteph » 24 Oct 2008, 20:58

Salut,

J'arrive pas a dessiner une sphère sur matlab,

avec la commande plot3, je suis arrivé a générer une hélicoïde
( x= sin(t), y=cos(t), z=t -> plot3 (x, y, z))

concernant la sphère j'ai essayé avec sa représentation paramétrique, avec deux parametres, ca m'a donné un griboullis dans l'espace qui ne veut rien dire :cry:
....

merci



phryte
Membre Irrationnel
Messages: 1406
Enregistré le: 05 Juil 2008, 18:09

par phryte » 25 Oct 2008, 09:04

Slt.
J'arrive pas a dessiner une sphère sur matlab,

Tu peux utiliser sphere(n) (sphere de (n+1) par (n+1))
Tu as accès aux valeurs par [x,y,z]=sphere(n) et là tu peux utiliser plot3(x,y,z)
....
Tu as la solution brutale :
clear
R=1;
n=1;
for theta=0:0.05:2*pi;
for phi=-pi/2:0.05:pi/2;
x(n)=R*cos(theta)*cos(phi);
y(n)=R*cos(theta)*sin(phi);
z(n)=R*sin(theta);
n=n+1;
end
end
plot3(x,y,z,'.','MarkerSize',1)
grid
En cherchant, tu aurais pu trouver sur l'excellent forum des développeurs à Matlab !
http://www.developpez.net/forums/d331619/autres-langages/algorithmes/mathematiques/algorithme-trace-sphere/
Et pour le fun :
clear
vert=[1 1 1;1 2 1;2 2 1;2 1 1;1 1 2;1 2 2;2 2 2;2 1 2];
fac=[1 2 3 4;2 6 7 3;4 3 7 8;1 5 8 4;1 2 6 5;5 6 7 8];
sphere(36);
h=findobj('Type','surface');
set(h,'FaceColor','interp',...
'EdgeColor',[.4 .4 .4],...
'BackFaceLighting','lit')
hold on
patch('faces',fac,'vertices',vert,'FaceColor','y');
light('Position',[1 3 2]);
light('Position',[-3 -1 3]);
material shiny
axis vis3d off
hold off

ericsteph
Membre Naturel
Messages: 96
Enregistré le: 05 Oct 2007, 21:46

par ericsteph » 25 Oct 2008, 16:30

Merci :zen:

 

Retourner vers ✯✎ Supérieur

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 34 invités

Tu pars déja ?



Fais toi aider gratuitement sur Maths-forum !

Créé un compte en 1 minute et pose ta question dans le forum ;-)
Inscription gratuite

Identification

Pas encore inscrit ?

Ou identifiez-vous :

Inscription gratuite