This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/linearalgebra/code/matrix2dtrafos.m
2014-11-12 18:39:02 +01:00

22 lines
777 B
Matlab

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