%for example...
%s=9/10, the scale factor
%theta=pi/8, the rotation
%t1=2, t2=1, for a shift right 2 units and up 1 unit
%N is the number of iterations

function[]=w(s,theta,t1,t2,N)

%make some object- in this case I made a circle
r=1; %radius 
xp=[-r:0.01:r]; 
xm=[-r:0.01:r];
yp=(r^2-xp.^2).^(1/2);
ym=-(r^2-xm.^2).^(1/2);
x=[xp,xm];
y=[yp,ym];

%plot the original object in red
figure(1)
hold off
plot(x,y,'m')
axis('equal','off')

%Define the transformation, w=A*v+t
S=[s 0 ; 0 s]; %scaling matrix
R=[cos(theta) -sin(theta) ; sin(theta) cos(theta)]; %rotation matrix
A=S*R; 
t=[t1;t2]; %shift vector

v=[x;y]; %let's write the points in vector form

for iterations=1:N
   %apply the transformation, w=A*v+t
   for n=1:length(x)
    v(:,n)=A*v(:,n)+t;
    x(n)=v(1,n);
    y(n)=v(2,n);
   end;
   %then, plot the newly transformed object
   hold on
   plot(x,y,'k')
end; %iterations
