Entering Matrices

You can enter matrices into MATLAB in several different ways.

Start by entering Dürer's matrix as a list of its elements. You have only to follow a few basic conventions:
  • Separate the elements of a row with blanks or commas.
  • Use a semicolon, ; , to indicate the end of each row.
  • Surround the entire list of elements with square brackets, [ ].
  • To enter Dürer's matrix , simply type,

            S = [16 3 2 13; 5 10 11 8; 9 6 7 12; 4 15 14 1]


    SCILAB displays the matrix you just entered,


            S =

            ! 16. 3. 2. 13. !
            ! 5. 10. 11. 8. !
            ! 9. 6. 7. 12.   !
            ! 4. 15. 14. 1. !

    This exactly matches the numbers in the engraving. Once you have entered the matrix, it is automatically remembered in the SCILAB workspace. You can refer to it simply as S.


    Fine now let us see why the matrix looks so interesting. 
    Why is it magic power in it?