Combining Two Or More Matrices Into One Matrix In MatLab(Illustrated Expression)
Matrices and matrix calculations are very important things in Linear Algebra and conventional mathematics. Matlab has lots of commands to ease these matrix calculations. In some cases, you need to combine various matrices into one matrix to make your calculation in Matlab. So it is very basic process to do it in Matlab.
How To Combine Different Matrices Into One Matrix In Matlab Programming?
We created a matrix called ‘a’ that is combination of two matrices; 3×3 eye matix and 3×3 random element matrix. These matrices are combined as row basis, because there is no semicolon between them at ‘a’. Row number of them must be equal to do this kind of combination, so there is no problem with the combination of them in Matlab.
To combine the matrices, just type them as an vector as shown by red and green arrows, and assign them to the variables.
Also two matrices are combined into ‘b’ matrix as shown by red arrow above; one of hem 3×3 eye matrix and one of them 1×3 ones matrix. As you can see, them combined in columnar basis, because there is a semicolon between combined matrices at ‘b’. Column numbers of eye and ones matrices are equal, so there is no problem with combination of them.
You can see the result of combinations as shown by blue and magenta arrows above in Matlab.
So it is very easy to combine two or more matrices into one matrix in Matlab.
Leave your comments or questions below!