clear %Enter the scale factor c, the translation vector (u,v), %and the rotation angle th. c=.95; u=.25; v=.5; th=pi/12; D=[c 0 0; 0 c 0; 0 0 1]; T=[1 0 u; 0 1 v; 0 0 1]; R=[cos(th) -sin(th) 0; sin(th) cos(th) 0; 0 0 1]; A=D*T*R; %The columns of the matrix below are the homogeneous %coordinates of the vertices of the unit square. box=[0 1 1 0 0; 0 0 1 1 0; 1 1 1 1 1]; for i=1:100 for j=1:4 line([box(1,j) box(1,j+1)],[box(2,j) box(2,j+1)],'color','blue') end box=A*box; end axis equal