Obtaining Desired Dimensioned Matrices With Same Numbers In MatLab(Illustrated Expression)

There are very useful Matlab codes to obtain specific matrices in short way which makes the Matlab is very useful tool to deal with matrices. One of these commands is the ‘repmat()’ command that you can use this to create matrices in desired dimensions with desired same number. In this article we will explain the use of ‘repmat()’ command in Matlab to obtain these matrices.

How To Use ‘repmat()’ Command In Matlab?

Use of ‘repmat()’ command in Matlab.

We created the ‘a’ matrix by using the ‘repmat()’ command in Matlab as shown by red arrow above. If you look at the ‘a’ variable as shown in red box above, a 5×5 matrix that includes only the number of 3 is created. So as you undertstand that, you need to type the number that you want first, and the dimensions of the matrix that you want respectively inside the ‘repmat()’ command in Matlab.

We multiplied the matrix ‘a’ with 3 then we assigned it to the variable ‘b’ as shown by green arrow above. If you look at the result as shown in green box, the whole elements of matrix ‘a’ is multiplied with 3 which means we can do mathematical operations with matrices that created with ‘repmat()’ command in Matlab.

So the use of ‘repmat()’ command is very simple like this in Matlab.

Leave your commentsand questions below!

Share This Post! Share Tweet Share

Write your comment on this topic.