%Carl's idea...
function[]=tree(iterations,paths,r,theta)
A1=[r*cos(theta) , -r*sin(theta) ; r*sin(theta) , r*cos(theta)];
A2=[r*cos(theta) , r*sin(theta) ; -r*sin(theta) , r*cos(theta)];
for j=1:paths    
 if j==1
 hold off
 end; 
%two points to define the line
x=[0 0];
y=[0 1];
%define the line as a vector
v=[x(2)-x(1);y(2)-y(1)];
plot(x,y,'k','Linewidth',2)
box on
axis('square','equal','off');
set(gcf, 'color', 'white');
for n=2:iterations
    k=rand;
    if k<0.5
    %then do A1, just the rotation and scaling of the vector, v   
    v=A1*v;
    else
    %then do A2, just the rotation and scaling of the vector, v 
    v=A2*v;
    end;
    %then, put the new vector in the correct location
    x=[x(2),x(2)+v(1)];
    y=[y(2),y(2)+v(2)];
    hold on
    plot(x,y,'k','Linewidth',2)
end %iterations
end %paths

