function out=lt2d(A,p) % % LT2D(A,p) overlays a polygon p in the plane and % its image A*p defined by multiplication by a % 2 x 2 matrix A that is passed as a parameter. % % The function is self-demonstrating -- it uses the % cat's face and a geometrically simple matrix A if % no (or only one) paramter(s) are provided. % % The function call typically is preceded by the % commands % % p=drawfig % Create a polygon % twoDexa % Define typical matrices % % Then repeatedly call this function with predefined % matrices lt2d(A1,p), lt2d(A2,p), lt2d(B3,p), ... % and twofold/threefold products like lt2d(A2*C3) or % lt2d(inv(C5)*A3*C5,p) or enter matrices by hand % lt2d([1 2; 3 -4],p) % % Typical task: Precisely describe the effect of % the linear transformation. Systematically organize % the observations with the goal of KNOWING the % effects of any of these matrices.... % % Author: Matthias Kawski. July 2000. % http://math.la.asu.edu/~kawski % % Update July 24, 00: Correction of help paragraph. % Pass polygon p as 2nd parameter. if nargin < 2 topx=[1 .98 .8 .83 .8 .77 .5 .25 0 -.25 -.5 -.8 -.8 -.98 -1]; topy=[0 .15 .7 1.15 1.03 1.15 .85 .95 1 .95 .85 1.2 .7 .15 0]; botx=-cos(pi*[1:10]/10); boty=-sin(pi*[1:10]/10); wiskx=[.2 1.3 .2 1.4 .2 1.4 .2 1.3 .2 .17 .13 .08 .03 0]; wisky=[ 0 .3 0 .1 0 -.1 0 -.3 0 .1 -.1 .1 -.1 0]-.2; xeye=[0 .2 .3 .4 .43 .45 .43 .4 .37 .35 .37 .4 .5 .6 .5 .4 .3 .2 0]; yeye=[.5 .5 .43 .4 .42 .5 .58 .6 .58 .5 .42 .4 .43 .5 .57 .6 .57 .5 .5]-.2; x=[topx,botx,wiskx,xeye,-xeye,fliplr(-wiskx)]; y=[topy,boty,wisky,yeye, yeye,fliplr(wisky)]; p=[x;y]; end if nargin < 1 A = [57 26; 26 27]/24 end clf axis([-5 5 -5 5]) hold on axis equal plot([-5 5],[0,0],'k') plot([0,0],[-5 5],'k') pplot(p,'r') disp('Strike any key to continue') pause ffill(A*p,'c') pplot(p,'r') text(-4.5,4,'A=','FontSize',14) text(-3.5,4,num2str(A,2),'FontSize',14) text(-4.5,2,'det A=','FontSize',14) text(-2,2,num2str(det(A),2),'FontSize',14) axis([-5 5 -5 5])