MATLAB Transpose Simulation Tutorial: Everything to Know
Table of Contents (click to navigate)
- What is a Matrix?
- Introduction to Matrix Transpose
- MATLAB Transpose Basics: Brief Tutorial in MATLAB with Exercises
What is a Matrix?
Aside from the fact that the term was made popular by the movie…”The Matrix”… real life matrices are by no means as exciting to watch, but the applications can provide the right thrills if you know how best to apply them to the relevant processes. Welcome to this tutorial on Matrix Transposition! This is your key to scientific and engineering mathematical transformations. The aim of today’s lecture is to make engineering and scientific calculations as easy as possible, so do enjoy!
Matrices are defined as rectangular arrays of numbers, symbols or expressions organized to represent the collated data in a series of rows and columns. Data is now the new oil, and the wealth is attained by transforming that data into information. With an ordered array of elements, represented by a mathematical lattice, one permits several computations to be executed on the data. Utilizing the basics of matrix theory, we will then apply the principles learned in the MATLAB user environment and perform these relevant functions.
For scientists and engineers, matrices are a dream come true! They are the perfect representation of linear transformations. Since mathematical models themselves can be complex, matrices are the perfect way to simplify data and organize it better. For faster computations, data compaction is an optimization tool. Since matrices are the perfect way of compacting information, physics and engineering applications heavily rely on matrix transformations for calculations. As a brief introduction, applications of matrices are as diverse as color theory applications, image processing, general relativity and a plethora of additional science and engineering applications. For those who have their eyes on the stars, in navigational applications, GPS systems use matrices to facilitate accurate calculations of global positions. As cellular phone technology and wireless technology expands, there will be an increased reliance on satellites to provide internet services to the expanding internet of things. In Chemical Process Engineering applications, equipment design elements and fluid calculations in computational fluid dynamics are represented as matrices, in order to determine their performance characteristics under certain turbulent conditions.
Excited yet? If so…let’s jump in. Matrix calculations today will be performed by MATLAB, whish as a software means Matrix Laboratory. This tutorial will expand on the tools powerful ability to compute these relevant functions.
Introduction to Matrix Transpose
A regular matrix is a collection of data in rows and columns. The left to right diagonal of the matrix marks the center of the matrix. This is the median through which the transpose function will be operated. The transpose of a matrix is a mathematical operation, which when conducted on an original matrix will invert the matrix over its diagonal. The operation will convert the columns of a matrix to rows, and convert the rows to columns.
Once the operation is completed, a new matrix AT will be formed as a result of the operation. The two matrices can then be further manipulated in order to generate the desired mathematical outcomes. Generally, the matrix operation of transposition takes place via three main steps in a manual computation, and with the advent of technology, the same operation can be repeated in a computer calculation. There are several rules of matrix transposition which the user can train themselves on. As a general rule of thumb, in the generation of the transpose matrix the property of self-inversion is respected. Once this function is facilitated, the transpose function facilitates addition, generation of a square matrix, determinant determination, dot product computations etc. From one simple transformation, mathematical magic is at your finger tips.
MATLAB Transpose Basics: Brief Tutorial in MATLAB
With the theory outlined above, let us now look at the various possibilities for Matrix Transpose statement calculations in the MATLAB R2018b user environment. A fresh command page is open below. As you can see, there are various possibilities for generating and manipulating code in the user environment. The critical windows for the exercise are the command window to the right hand side of the screen. This is where the relevant code for the program will be entered. To the bottom left will be the workspace, is where the answers will be displayed.
Since MATLAB is code based, we will begin with the Syntax for the transpose function. From the MATLAB workbook the following is the program’s syntax for the function:
B = A.'
MATLAB functions perform two main operations on the original matrix. In the first syntax operation B = A.’, the operation will facilitate the calculation of the nonconjugate transpose of the matrix A. This is the column row inversion that was previously described. Another way to perform the same function via an alternate code is denoted by the code B = transpose(A). With the code identified, let us apply some real world examples to our new learnings. From the MATLAB workbook, the following example asks us to create the following matrix:
Objective: Create a matrix of real numbers and compute its transpose.
B has the same elements as
A, but the rows of
B are the columns of
A and the columns of
B are the rows of
A = magic(4)
Entering this statement into the MATLAB Command Center yields the following 4 x 4 matrix:
The question next asks for the transpose of A to form the matrix B. The transpose is the inversion of A on its diagonal (16, 11, 6, 1) and the formation of the rows into columns and columns into row. Entering the following code:
B = A.’
The following is the resultant matrix:
The process is straight forward once the data has been entered. If necessary, enter your own matrix data, and then continue the process of transposing those matrices for your own practice. Let’s raise the complexity some more. From the MATLAB workbook the following Complex Matrix has been proposed:
Objective: Create a matrix containing complex elements and compute its nonconjugate transpose.
B contains the same elements as
A, except the rows and columns are interchanged. The signs of the imaginary parts are unchanged.
The relevant matrix that we are focusing on is:
A = [1 3 4-1i 2+2i; 0+1i 1-1i 5 6-1i]
Entering that statement into the MATLAB Command Center yields the 2×4 complex matrix:
Once again, to find the transpose we enter the code:
B = A.’
Which yields the 4×2 complex matrix shown in the image below:
The transpose computation function in MATLAB is quite easy to compute. It is one of the simpler functions in the MATLAB user environment. Despite the simplicity of the function, there are a myriad of applications for this function. The description of physical systems in general, requires the need for the use of matrix computations in order to represent the systems well. In processing many mathematical models, there will be a need to model systems that contain partial differential equations. A simple example that can be given is the modelling of crystals formed in a batch crystallizer by Chemical Engineers. Population balance models contain partial differential equations which are solved by the computational software of choice. Partial differential equation computation is challenging, and computer systems attempt to linearize them in order to determine the final outcome of a crystallization progression. Utilizing a means for identifying symmetries in a data pool, and representing the data by small clusters of matrices is one way of facilitating the appropriate approximate solution to a crystallization problem.
Additionally, the tutorial discussion began with color science applications. Color science has gained widespread applications along with image science, over the past decade. With the advent of computer technologies, smart phones, tablets and personal computers all utilize screens. The screen resolutions, the user’s ability to invert the images once taken, the ability for all computer screens to rotate and for the image size to match the new orientation, are all facilitated via the application of matrix transformations. As simple as the operation is in the medium, the applications are not to be discounted.
From the computations and detailed theory and background above, it can easily be identified that MATLAB R2018b is a powerful simulation tool. The system does require specialized knowledge in order to properly code and navigate the system, and has an initially steep learning curve. Fortunately, there are plenty of support tools and tutorials such as ours that are available online, that will facilitate a smooth transition to the world of MATLAB. As gamification is on the rise, users will enjoy the challenge that the system will provide in order to help them achieve in a fun and interactive manner the means via which their systems can be modelled before actual computation. IF statement computations are ubiquitous, and they can only help us to advance science and technology. Use the tutorial above to help with your scientific and engineering needs.
Tandose Sambo is a Chemical Process Engineer, with a focus on improving process efficiency via operational improvements. Six-Sigma certified, and with a Design-focus and Data Analytics interest, she is a driven growing entrepreneur, with the intention to optimize industrial and business process operations. Her interests include sharing time with family and travelling.