next up previous adam-math, MATmatcc, MMKOMP MMkomp2 Adam WILEY-VCH MATLAB-Filme Projekte und M-Files Stefan Adam privat Mail to stefan.r.a.adam@gmail.com MMkomp ed1 Adam
Nächste Seite: Parkhausrampe Aufwärts: MMkomp2 Filmserie Vorherige Seite: Reguläre Polygone

3D Lissajous-Figuren

Die Lissajous-Figuren, welche sowohl in x- als auch in y-Richtung je einer sinus/cosinus-Funktion folgen, wurden für diese animierte Darstellung sinngemäss zu dreidimensionalen Kurven ergänzt.

function voidbk = liss3dfilm(varargin)
%liss3dmn Film einer Lissajous-Figur MLISS:NLISS (def 1:2) in 3D
t = (0:0.004:1)*2*pi;  voidbk = 0;
%test
%  nur standalone!! 
  figure(1); clf ; axis([-10 10 -10 10]), axis square; hold on
  axis off;
lisscaspaus = 0.15; lissrunpaus = 0.012;
r=7.7;  tet = 13*pi/180;
nl = [1 1 2 2]; ml = [1 2 1 3];
for irep =2:3
pause(lisscaspaus)
  a = nl(irep); b = ml(irep);
  x = r*cos(a*t) ;  y = r*sin(a*t) ;  z = r*cos(b*t);
  zc1 =r* ones(1,length(t)) ;  zc2 = -r*ones(1,length(t));
  xl = [r r] ;  yl = [0 0] ;  zl = [-r r];
%
  hdkr1 = plot3ers(x,y,zc1, 0,tet,0,0,'g',2) ; 
  hdkr2 = plot3ers(x,y,zc2, 0,tet,0,0,'g',2) ; 
    hdlli = plot3ers(xl,yl,zl,pi/2,tet, 0,0,'g',2) ;  
    hdlre = plot3ers(xl,yl,zl, -pi/2,tet, 0,0,'g',2) ;  
%
  for k=0:1:360
    wink = k*pi/180;
    hdlln = plot3ers(x,y,z, -wink,tet, 0,0,'k',2) ; 
    hdlrn = plot3ers(xl,yl,zl, -wink,tet, 0,0,'r',2) ;  
    hdlbn = plot3ers(yl,xl,zl, -wink,tet, 0,0,'b',2);
    if k>0
      delete(hdllo);delete(hdlro);delete(hdlbo);
    end
    hdllo = hdlln;  hdlro  = hdlrn  ;  hdlbo = hdlbn;
    pause(lissrunpaus);
  end 
    pause(lisscaspaus) 
  delete(hdllo);delete(hdlro);delete(hdlbo);
  delete(hdkr1); delete(hdkr2);
  delete(hdlli);  delete(hdlre);
end
function plhdb = plot3ers(x,y,z,w,t,xof,yof,col,thik)
% function plhdb = plot3ers(x,y,z,w,t,xof,yof,col,thik)
% Ersatz fuer plot3
%  mit Zusatz-Parametern   w , t horizontaler und vertikaler Drehwinkel
%  xof, yof  x- und y- Offset (Zusatz) nach Projektion in 2D
%  col  Farbe und thik Liniendicke
%  Rueckgabe plhdb  plot-handle des 2D plot-Aufrufs
zrm = [cos(w) -sin(w) 0;  sin(w) cos(w) 0 ; 0 0 1];
yrm = [  cos(t) 0 -sin(t) ; 0 1 0;  sin(t) 0  cos(t) ];
trko = yrm*zrm*[x;y;z];
plhdb = plot(trko(2,:)+xof, trko(3,:)+yof,col,'LineWidth',thik); 
end  % function plot3ers
end  % function liss3dfilm 



2018-09-15