Octave-Animationen


Octave -Plots als Datei speichern und Animationen generieren.

text

N=20;   % Number of frames per animation cycle
M = 3;  % Number of arms
e = 2.1; % Plot size

% Delete old graphics
delete("oa_*.gif")



a=linspace(0,2*pi,360/M);
v=0;
b=0;
for k=1:N

    %  calculate animation
    b=b+(2*pi/N/M);
    hold off;
    r=sin(a*M)+1;
    x=sin(a+b).*r;
    y=cos(a+b).*r;
   
    % plot figure
    fill(x,y,"r");
    ylim([-e e])
    xlim([-e e])
    axis equal;
    ax = gca ();
    set (ax, "position", [0, 0, 1, 1]);  % Set axes equal to figure size
   
    % print figure to file
    if k>9
        sZero = '';
    else
        sZero = '0';
    end
    print(['oa_' sZero num2str(k) '.gif'], "-S300,300")
    replot
   
   
end    


Das Skript generiert Einzelbilder, die anschließend mit einem Programm, wie z.B. animakedt zusammengeführt werden können.


Siehe auch
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki