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/simplematrixbox.m
2014-11-12 18:39:02 +01:00

22 lines
622 B
Matlab

function simplematrixbox( a, s )
% visualizes the effect of a matrix a on a set of vectors forming a box
% a: a 2x2 matrix
% s: a string plotted as the title of the plot
% this function is called by simplematrix2dtrafos.m
% this is a simple version of the more elaborate matrixbox() function.
x = [ 0 1 1 0 0 1; 0 0 1 1 0 1 ];
plot( x(1,:), x(2,:), '-b' );
hold on;
y = a*x;
plot( y(1,:), y(2,:), '-r' );
[ ev ed ] = eig( a );
ev = ev * ed;
quiver( [0 0], [0 0], ev(1,:), ev(2,:), 1.0, 'g' )
hold off;
xlim( [-2 2 ] )
ylim( [-2 2] )
title( s );
waitforbuttonpress;
end