% Visualize some common matrix transformations % in a 2D coordinate system % this uses the simplematrixbox() function for visualization % use the matrix2dtrafos script for the the nicer matrixbox() function. disp( 'Click into the plot to advance to the next matrix' ) simplematrixbox( [ 1 0; 0 1], 'Identity' ); simplematrixbox( [ 2 0; 0 1], 'Scale x' ); simplematrixbox( [ 1 0; 0 2], 'Scale y' ); simplematrixbox( [ 2 0; 0 2], 'Scale x and y' ); simplematrixbox( [ 0.5 0; 0 0.5], 'Scale x and y' ); simplematrixbox( [ -1 0; 0 1], 'Flip x' ); simplematrixbox( [ 1 0; 0 -1], 'Flip y' ); simplematrixbox( [ -1 0; 0 -1], 'Flip both' ); simplematrixbox( [ 1 1; 0 1], 'Shear x' ); simplematrixbox( [ 1 0; 1 1], 'Shear y' ); % rotation matrices: for deg = 0:10:360 phi = deg*pi/180.0; simplematrixbox( [ cos(phi) -sin(phi); sin(phi) cos(phi)], sprintf( 'Rotate %.0f', deg ) ); end