Rechercher : dans
Par :

Animation 3D MATLAB

Dernière réponse le 8 jui 2008 à 17:34:02 Irene_Adler, le 7 jui 2008 à 18:51:20 
 Signaler ce message aux modérateurs

Bonjour à tous,
Je programme une petite animation sur MATLAB et j'ai besoin de fixer l'axe Z pour que l'echelle ne change pas à chaque 'surf'... Comment faire?
Voici mon programme:


function animate(nb,mx,ny)
reruns=1; % number of times movie is to play
fps=5; % frames per second

nframes = nb; % number of frames in the movie
Frames = moviein(nframes); % initialize the matrix 'Frames'

title('FUNWAVE MOVIE')
colormap('jet')
map=jet;
fid=fopen('animation.dat'); % dans animation.dat il y a les noms des fichiers
tab=fscanf(fid,'%s',[401]);
bg=1;
ed=12;
[X,Y,Z]=OpenFunwaveForm1(tab(bg:ed),mx,ny);
zl=max(abs(Z));
zlim=[-zl,zl];
for i=2:nb
bg=bg+12
ed=ed+12
OpenFunwaveForm1(tab(bg:ed),mx,ny);
Frames(:,i)=getframe;
end

return
% OpenFunwaveForm1 est une fonction qui affiche ma figure de la maniere la plus simple, avec tous les parametres par %défaut

Merci aux âmes charitables!

PS: Toutes les critiques sur mon programme sont acceptées :)

Freedom is the freedom to say that 2+2 make 4. If that is granted, all else follows.
1984, ORWELL

Configuration: Linux Suse
Firefox 2.0.0.10

Meilleures réponses pour « Animation 3D MATLAB » dans :
Logiciels 3D VoirVoici une sélection de logiciels 3D gratuits: Blender 3D Canvas 7.1 TrueSpace 3.2 Art of Illusion Wings 3D KPovModeler OpenFX K-3D Daz Studio Blender
Télécharger KaraFun VoirKaraFun est un logiciel de karaoké gratuit et complet sur PC. A la fois lecteur et éditeur de karaokés, il utilise un moteur d'animation 3D unique. KaraFun gère aussi bien l'Audio que le MIDI et lit parfaitement un grand nombre de fichiers : KFN,...

1

Sacabouffe, le 8 jui 2008 à 00:34:22

Salut

OpenFunwaveForm1(tab(bg:ed),mx,ny);
zlim([-zl zl]);
A plus Thought I heard a rumbling, calling to my name
Two hundred million guns are loaded, Satan cries "Take aim!"

Répondre à Sacabouffe

2

Irene_Adler, le 8 jui 2008 à 17:12:10

LoL! Merci Sacabouffe!
J'ai corrigé d'autres erreurs:
REMARQUE: zl=max(abs(Z)); donne un vecteur car Z est une matrice 101x101, il fallait donc faire une boucle pour trouver le max (il y a sans doute une manière plus simple...)

voici donc le programme final:



function animate(nb,mx,ny)
reruns=1; % number of times movie is to play
fps=5; % frames per second

nframes = nb; % number of frames in the movie
Frames = moviein(nframes); % initialize the matrix 'Frames'

title('FUNWAVE MOVIE')
colormap('jet')
map=jet;
fid=fopen('animation.dat');
tab=fscanf(fid,'%s',[401]);
bg=1;
ed=12;
[X,Y,Z]=OpenFunwaveForm1(tab(bg:ed),mx,ny);
k=max(abs(Z(:,1)));
for j=2:ny
if k<max(abs(Z(:,j)))
k=max(abs(Z(:,j)))
end
end
k=k+k;
zlim([-k k]);
view(-90,0);
Frames(:,1)=getframe
for i=2:nb
bg=bg+12
ed=ed+12
OpenFunwaveForm1(tab(bg:ed),mx,ny);
zlim([-k k]);
view(-90,0);
Frames(:,i)=getframe;
end
% Now play the movie:
%movie(Frames,reruns,fps)

% Now save the movie as an mpeg file for use on the Web:
map=colormap
% mpgwrite(Frames,map,'funwave.mpg')
return

Freedom is the freedom to say that 2+2 make 4. If that is granted, all else follows.
1984, ORWELL

Répondre à Irene_Adler

3

Sacabouffe, le 8 jui 2008 à 17:20:24

Salut
Oui il y a pluys simple. J'avais pas fait gaffe à ce détail dans ton code, j'avais juste regardé ton souci d'axe Z.

k=max(max(abs(Z)));
A plus Thought I heard a rumbling, calling to my name
Two hundred million guns are loaded, Satan cries "Take aim!"

Répondre à Sacabouffe

4

Irene_Adler, le 8 jui 2008 à 17:32:05

C'est Vrai (j'adore me compliquer la vie ;D )
Merci et à plus!
Freedom is the freedom to say that 2+2 make 4. If that is granted, all else follows.
1984, ORWELL

Répondre à Irene_Adler

5

 Sacabouffe, le 8 jui 2008 à 17:34:02

De rien :-D
A plus Thought I heard a rumbling, calling to my name
Two hundred million guns are loaded, Satan cries "Take aim!"

Répondre à Sacabouffe