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/simulations/matrix2dtrafos.m

75 lines
1.2 KiB
Matlab

m = [ 1 0; 0 1];
matrixbox( m );
title( 'Identity' );
waitforbuttonpress;
m = [ 2 0; 0 1];
matrixbox( m );
title( 'Scale x' );
waitforbuttonpress;
m = [ 1 0; 0 2];
matrixbox( m );
title( 'Scale y' );
waitforbuttonpress;
m = [ 2 0; 0 2];
matrixbox( m );
title( 'Scale both' );
waitforbuttonpress;
m = [ -1 0; 0 1];
matrixbox( m );
title( 'Flip x' );
waitforbuttonpress;
m = [ 1 0; 0 -1];
matrixbox( m );
title( 'Flip y' );
waitforbuttonpress;
m = [ -1 0; 0 -1];
matrixbox( m );
title( 'Flip both' );
waitforbuttonpress;
m = [ 1 0; 1 1];
matrixbox( m );
title( 'Shear x' );
waitforbuttonpress;
m = [ 1 1; 0 1];
matrixbox( m );
title( 'Shear y' );
waitforbuttonpress;
phi = 0.1667*pi;
m = [ cos(phi) -sin(phi); sin(phi) cos(phi)];
matrixbox( m );
title( 'Rotate 30' );
waitforbuttonpress;
phi = 0.333*pi;
m = [ cos(phi) -sin(phi); sin(phi) cos(phi)];
matrixbox( m );
title( 'Rotate 60' );
waitforbuttonpress;
phi = 0.5*pi;
m = [ cos(phi) -sin(phi); sin(phi) cos(phi)];
matrixbox( m );
title( 'Rotate 90' );
waitforbuttonpress;
phi = 0.75*pi;
m = [ cos(phi) -sin(phi); sin(phi) cos(phi)];
matrixbox( m );
title( 'Rotate 135' );
waitforbuttonpress;
phi = 1.0*pi;
m = [ cos(phi) -sin(phi); sin(phi) cos(phi)];
matrixbox( m );
title( 'Rotate 180' );
waitforbuttonpress;