213 - A18.5 - Graphical Transformations (Matlab)

29 days ago by Professor213

x = [1 3 4 0] y = [2 1 0 1] A = [1 0 ; 0 -1] out = A*[x; y] fill(x,y,'r',out(1,:),out(2,:),'b') axis('square','on') out(1,:) 
       
x =

 1 3 4 0

y =

 2 1 0 1

A =

 1 0
 0 -1

out =

 1 3 4 0
 -2 -1 0 -1

ans =

 1 3 4 0

                                                                        

           2 |---------------------------------------------------|      

             |         ##XXXXXXX  #####+            +            |      

             |      ###XXXXXXXXXXXXXX  ######                    |      

             |   ###XXXXXXXXXXXXXXXXXXXXXX   #####               |      

             | ##XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   ##             |      

           1 |#####XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX####       +-|      

             |     ##########XXXXXXXXXXXXXXXXXXXXXXXXXX ###      |      

             |               ###########XXXXXXXXXXXXXXXXXX ###   |      

             |                          ##########XXXXXXXXXX  ## |      

             |                                    ##########XXX #|      

           0 |-+                                  %%%%%%%%%%%%%%%|      

             |                          %%%%%%%%%%     XXXXXXX%% |      

             |               %%%%%%%%%%%    XXXXXXXXXXXXXXX%%%   |      

             |     %%%%%%%%%%     XXXXXXXXXXXXXXXXXXXXXX%%%      |      

             |%%%%%    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%%         |      

          -1 |%%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%%%%         +-|      

             |  X%%%XXXXXXXXXXXXXXXXXXXXXXXXX%%%%%               |      

             |    XX%%%XXXXXXXXXXXXXXXX%%%%%%                    |      

             |       XX%%XXXXXXXXX%%%%%                          |      

             |         XX%XXX%%%%%     +            +            |      

          -2 |---------------------------------------------------|      

             0            1            2            3            4      

                                                                        
x =

 1 3 4 0

y =

 2 1 0 1

A =

 1 0
 0 -1

out =

 1 3 4 0
 -2 -1 0 -1

ans =

 1 3 4 0

                                                                               
           2 |---------------------------------------------------|             
             |         ##XXXXXXX  #####+            +            |             
             |      ###XXXXXXXXXXXXXX  ######                    |             
             |   ###XXXXXXXXXXXXXXXXXXXXXX   #####               |             
             | ##XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   ##             |             
           1 |#####XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX####       +-|             
             |     ##########XXXXXXXXXXXXXXXXXXXXXXXXXX ###      |             
             |               ###########XXXXXXXXXXXXXXXXXX ###   |             
             |                          ##########XXXXXXXXXX  ## |             
             |                                    ##########XXX #|             
           0 |-+                                  %%%%%%%%%%%%%%%|             
             |                          %%%%%%%%%%     XXXXXXX%% |             
             |               %%%%%%%%%%%    XXXXXXXXXXXXXXX%%%   |             
             |     %%%%%%%%%%     XXXXXXXXXXXXXXXXXXXXXX%%%      |             
             |%%%%%    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%%         |             
          -1 |%%%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%%%%         +-|             
             |  X%%%XXXXXXXXXXXXXXXXXXXXXXXXX%%%%%               |             
             |    XX%%%XXXXXXXXXXXXXXXX%%%%%%                    |             
             |       XX%%XXXXXXXXX%%%%%                          |             
             |         XX%XXX%%%%%     +            +            |             
          -2 |---------------------------------------------------|             
             0            1            2            3            4