# Matrices And Vectors With Randomly Created Elements In MatLab(Illustrated Expression)

Like in every programming language, Matlab has a command that creates a random number or numbers. But in Matlab, you can create matrices and vectors that includes randomly created elements inside it. In this article, we will show you how to create matrices or vectors that their elements are randomly created.

### How To Create Matrices And Vectors That Includes Random Elements In Matlab?

Use of rand() command to create matrices and vectors in Matlab.

The ‘a’ is a matrice that created by random numbers as shown by orange arrow above in Matlab. It is a 3×2 matrix as shown by green arrow above and created with rand() command.

Also vector ‘b’ is randomly numbered vector that is created by rand() command again. Actually it is a 1×3 matrix but also means it is vector as shown by red arrow and yellow arrow above.

These ‘a’ matrix and ‘b’ vector is multiplied with integers as shown by red box above. Because **rand() command in Matlab, **creates random numbers between 0 and 1. You can do multiplication as above to obtain number between integers that you want. Multiplied vector and matrix could be seen by magenta arrow and blue arrow above.

The logic of creating matrices and vectors with rand() command in Matlab is like that.

Leave your questions and comments below!

[…] some cases, you need to index the summation of elements in a matrix or vector in Matlab to use them in further calculations. This process is very easy in Matlan that you can use […]

[…] you can see, how to create increment vectors in this link from Mechanical […]

[…] statistical analysis. MatLab provides a command that you can do cumulative summations of different vectors, and matrices. This command is called as […]

[…] calculates calculus problems in Matlab. You can calculate the factorials of various kinds of vectors and matrices in Matlab easily with ‘factorial()’ command in Matlab. In here, we explain […]