% pingpong.m
%
A = [1 2; 0 1];                         % the matrix
for n=1:2500,                           % do the following 2500 times
    x = randn(2,1);                     % generate a random point
    [~,ord] = sort(abs(x),1,'descend'); % find the order of their magnitudes
    x = x(ord);                         % reorder the elements
    y = A*x;                            % transform via A
    plot(x(1),x(2),'k.')                % plot the original point
    hold on                             % save this picture
    plot(y(1),y(2),'r.')                % plot the transformed point
end
plot([-3 3],[3 -3],'b')                 % plot the NW-SE diagonal
plot([-3 3],[-3 3],'b')                 % plot the SW-NE diagonal
axis equal                              % set aspect ratio to one
axis tight                              % remove extra space
hold off                                % let go of the picture

