Code covered by the BSD License  

Highlights from
Flying Butterfly

image thumbnail

Flying Butterfly

by

 

This generates an animated butterfly

flying_butterfly.m
%Author: Nuwan Ganganath

close all;
t = 0:.01:2*pi;
r = exp(cos(t))-2*cos(4*t)+(sin((2*t-pi)/24)).^5;
[X,Y] = pol2cart(t,r);
figure(1);
for i=-100:1:100
    Z = 2*sin(i).*abs(Y);
    scatter3(X,Y,Z,'r','fill');  
    view([-1,-0.2,0.4]);zlim([-10 10]);axis off;
    pause(0.2);
end

Contact us