Animation

Spiral Animation

MATLAB code for above video. The colors are different from the video but animation is same. In for loop the value of n increments by 1 this gives a phase difference to function cos(r-0.04*n*pi) and gives a rotation in spiral. Variable k decides the number of streaks coming out of the center of image. For k = 1 one black and one white streak will come out. Some variations in the animation can be made by using these functions.

zval=(sin(5*(r)+k*tt-0.11*pi*n));

zval=(sin(-2.5*log(r)+k*tt+0.1*pi*n));

zval=(sin(10*r.^2+k*tt-0.11*pi*n));

total=150;

lim=2*pi;

k=1;

x = linspace(-lim,lim,total);

y = linspace(-lim,lim,total);

c = zeros(length(y),length(x));

lenx = length(x);

leny = length(y);

for n = 1:lenx

c(n,:) = x(n)+i*y(:);

end

zval = zeros(lenx,leny);

tt=angle(c);

r=abs(c);

colormap gray(128)

for n=1:150

zval=(sin(6*cos(r-0.04*n*pi)+k*tt));

pcolor(zval)

shading interp

axis square off

drawnow

end