Making Matrices


  • To define a parameter as a matrix, the general procedure involves first stating the name or symbol of the parameter and then stating it is equal to a combination of elements enclosed in square brackets.
  • For instance, the elements of a 3-by-3 matrix would be typed in like this [1,2,3;4,5,6;7,8,9] or [1 2 3; 4 5 6; 7 8 9]. The elements within a row are separated by either a comma or space; rows are separated by semicolons.

1             2

CHECKPOINTConcatenating matrices (conca – what?)

What matrices do you think the following combinations would generate? Try it out by hand first and then run the code!

  1. C = [A , B]
  2. D = [A ; B]
  3. E= [A , B; B, A]


This process is termed concatenating of matrices and is used to make larger matrices from smaller ones. Remember, even when we try to compute a matrix by inputting each of the individual components, MATLAB understands them as small 1-by-1 matrices.