RT wrote

I'm trying to animate two 3d plots at the same time but I keep getting

flickering does anyone now of a workaround or how to prevent the flickering?

See code below: I'm using octave 4.0 on ubuntu 16.04 64bit

k1 = 1; %how many times you want wave to oscillate in x-dir

k2 = 1; %how many times you want wave to oscillate in y-dir

u = linspace(-pi,pi,30); %how many segments

v = linspace(-pi,pi,30); % how many segments

[x,y] = meshgrid(u,v); %how many segments

w_len=max(length(x))

for ii=1:180

z=sin(k2*x+(ii)*pi/180);

z2=-sin(k2*y+(ii)*pi/180);

surf(x,y,z);

drawnow

surf(x,y,z2);

drawnow

pause(.001)

end

_______________________________________________

Help-octave mailing list

[hidden email]https://lists.gnu.org/mailman/listinfo/help-octave

You can also bind surface "zdata" to a given variable using "zdatasource" and then use "refreshdata ()" to update plots when the variable has changed. Something like:

...

w_len=max(length(x))

z = z2 = x;

surf (x, y, z, "zdatasource", "z");

hold on

surf (x, y, z2, "zdatasource", "z2");

for ii=1:180

z=sin(k2*x+(ii)*pi/180);

z2=-sin(k2*y+(ii)*pi/180);

refreshdata ()

pause(.001)

end

Pantxo