repmat
Construct a matrix from a smaller matrix by stacking copies of the latter in the horizontal and vertical directions.
(u)=repmat(a, m)
(u)=repmat(a, m, n)
Inputs
a A matrix.
m A scalar integer.
n A scalar integer. If unspecified, assumed to be same as m .
Outputs
u The matrix obtained by stacking vertically the matrix a m times, and horizontally stacking this matrix n times.


Example
>>a=[1 2;3 4]
>>repmat(a,2)
          1          2          1          2
          3          4          3          4
          1          2          1          2
          3          4          3          4
>>repmat(a,2,1)
          1          2
          3          4
          1          2
          3          4
>>repmat(a,2,3)
          1          2          1          2          1          2
          3          4          3          4          3          4
          1          2          1          2          1          2
          3          4          3          4          3          4