MatLab Assignment 4 -- Turn in on April 9

--
MatLab graphing facilities: plot, subplot, title, text, axis
--- A application of linear transformation: computer graphics and animation

If you have any question or problem with MatLab, please send me an email at: chenm or call me at: 953-7896.

  1. Take a few minutes to read the MatLab handout (4) to learn above MatLab graphing facilities: plot, subplot, title, text, axis.

  2. You may also take a few minutes to read the application given on Page 181-183.

  3. An example: Let T=[0 1 1 0;0 1 -1 0], the same matrix as given on Page 181. The following is a list of MatLab commands which do the following.
        clf
        tmat=[0 1 1 0;0 1 -1 0];
        subplot(221),plot(tmat(1,:),tmat(2,:),'-')
        subplot(221),axis([-5 5 -5 5])
        text(0,0,'+')
        title('original triangle')
        axis square
        %
        tmat=2*tmat;
        theta=2*pi/3;
        rmat=[cos(theta) -sin(theta);sin(theta) cos(theta)];
        tmat=rmat*tmat;
        subplot(222),plot(tmat(1,:),tmat(2,:),'-')
        subplot(222),axis([-5 5 -5 5])
        text(0,0,'+')
        title('dilation and rotation')
        axis square
        %
        for i=1:4;
            tmat(:,i)=tmat(:,i)+[1;2];
        end;
        subplot(223),plot(tmat(1,:),tmat(2,:),'-')
        subplot(223),axis([-5 5 -5 5])
        text(0,0,'+')
        title('translation')
        axis square
        %
        amat=[1 0;0 -1];
        tmat=amat*tmat;
        subplot(224),plot(tmat(1,:),tmat(2,:),'-')
        subplot(224),axis([-5 5 -5 5])
        text(0,0,'+')
        title('reflection')
        axis square
    
    The graphs are given at the end of this assignment.
    You may copy and paste above list into the notepad and save it as a matLab file (with extension .m). Run it in MatLab to see how it works.

  4. Here is what you are asked to do.
























Graphs of the example: