% % This code plot a flame by means of fratal geometry
% % written by Shan Jin
% % modified on Mar 16,2019
u=[0;1;0.5+0.5i*sqrt(3);0]; % Initial Triangle
% u=[0,1,0.5+0.5i*sqrt(3),0,nan]; % an alternative statement
figure
for k=1:6
subplot(2,3,k)
plot(u,'r'); axis off
m=1/3*u; % contract its size to 1/3 of the former one
u=[m,m+2/3,m+1/3+1i*sqrt(3)/3,...
sqrt(3)*exp(1i*pi/2)*m+2/3]; % place new pattern
end