Matrices and Matrix Operations in Matlab:
Matrix operations:
Recollect how to multiply a matrix A times a vector v:
This is a particular case of matrix multiplication. To multiply two matrices A as well as B you proceed as follows:
Here both A as well as B are 2 × 2 matrices. Matrices are able to be multiplied together in this way provided that the number of columns of A matches the number of rows of B. We forever list the size of a matrix by rows then columns therefore a 3 × 5 matrix would have 3 rows and 5 columns. Consequently if A is m × n and B is p × q then we is able to multiply AB if and only if n = p. A column vector is able to be thought of as a p×1 matrix and a row vector as a 1×q matrix. Unless or else specified we will presume a vector v to be a column vector and so Av makes nous as long as the number of columns of A matches the number of entries in v.
Printing matrices on the screen takes up a large number of space so you may want to utilize:
>format compact
Enter a matrix into Mat lab with the following syntax
> A = [ 1 3 -2 5 ; -1 -1 5 4 ; 0 1 -9 0]
As well enter a vector u
> u = [ 1 2 3 4]’
To multiply a matrix times a vector Au utilize *:
> A*u
Since A is 3 by 4 also u is 4 by 1 this multiplication is valid as well as the result is a 3 by 1 vector.
At present enter another matrix B using
> B = [3 2 1; 7 6 5; 4 3 2]
You are able to multiply B times A:
> B*A
But A times B isn’t defined and
> A*B
Will result in an error message
You are able to multiply a matrix by a scalar
> 2*A
Adding matrices A + A will give the similar result
> A + A
You are able to even add a number to a matrix
> A + 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . This must add 3 to every entry of A.
Component-wise operations:
Merely as for vectors, adding a ’.’ prior to ‘*’, ‘/’, or ‘^’ produces entry-wise multiplication division as well as exponentiation. If you enter
> B*B
the result will be BB that is matrix multiplication of B times itself. However if you enter
> B.*B
The entries of the resulting matrix will holds the squares of the same entries of B. Likewise if you wish for B multiplied by itself 3 times then enter
> B^3
However if you want to cube all the entries of B then enter
> B.^3
Note that B*B and B^3 merely make sense if B is square however B.*B and B.^3 make intelligence for any size matrix.
The identity matrix as well as the inverse of a matrix.
The n × n identity matrix is a square matrix with ones on the diagonal as well as zeros everywhere else.
It is called the identity for the reason that it plays the same role that 1 plays in multiplication that is
AI = A, IA = A, Iv = v
For any matrix A or vector v where the sizes match. An identity matrix in Mat lab is produced by the command:
> I = eye(3)
A square matrix A is able to have an inverse which is denoted by A−1. The description of the inverse is that
AA−1 = I and A−1A = I.
In theory an inverse is extremely important because if you have an equation:
Ax = b
Where A as well as b is known and x is unknown (since we will see such problems are very common and significant) then the theoretical solution is
x = A−1b.
We will observe later that this is not a practical way to solve an equation, and A−1 is only important for the purpose of derivations.
In Malta we are able to calculate a matrix’s inverse very conveniently:
> C = randn(5,5)>inv(C)
Nevertheless not all square matrices have inverses:
> D = ones(5,5)>inv(D)
The ‘Norm’ of a matrix:
For a vector the ‘norm’ means the same thing as the length. One more way to think of it is how far the vector is from being the zero vector. We desire to measure a matrix in much the same way and the norm is such a quantity. The typical definition of the norm of a matrix is the following:
Definition 1 assumes A is am × n matrix. The norm of A is:
|A|≡ Max^|A|=1|Av|
The maximum in the definition is taken over every vectors with length 1 (unit vectors) thus the definition means the largest factor that the matrix stretches (or shrinks) a unit vector. This definition appears cumbersome at first but it turns out to be the best one.
For illustration with this definition we have the following inequality for any vector v
|Av| ≤ |A||v|.
In Mat lab the norm of the matrix is acquired by the command
>norm(A)
For illustration the norm of an identity matrix is 1:
>norm(eye(100))
And the norm of a zero matrix is 0:
>norm(zeros(50,50))
For a matrix the norm defined above as well as calculated by Mat lab isn’t the square root of the sum of the square of its entries. That amount is called the Froebenius norm which is as well sometimes useful however we will not need it.
A few other useful commands:
Try out the following:
> C = rand(5,5) *******************arbitrary matrix with uniform distribution in [0, 1].>size(C) ***********************************. Provides the dimensions (m × n) of C.>det(C) ******************************************* the determinant of the matrix.> max(C****************************************** the maximum of each column.>min(C) ***************************************** the minimum in each column.> sum(C)**************************************************sums each column.> mean(C) ******************************************* the average of each column.>diag(C) ******************************************** just the diagonal elements.> C’ *******************************************************tranpose the matrix.
Additionally to zeros, eye, ones, rand and randn Mat lab has numerous other commands that automatically produce special matrices
>hilb(6)>pascal(5)
Latest technology based Matlab Programming Online Tutoring Assistance
Tutors, at the www.tutorsglobe.com, take pledge to provide full satisfaction and assurance in Matlab Programming help via online tutoring. Students are getting 100% satisfaction by online tutors across the globe. Here you can get homework help for Matlab Programming, project ideas and tutorials. We provide email based Matlab Programming help. You can join us to ask queries 24x7 with live, experienced and qualified online tutors specialized in Matlab Programming. Through Online Tutoring, you would be able to complete your homework or assignments at your home. Tutors at the TutorsGlobe are committed to provide the best quality online tutoring assistance for Matlab Programming Homework help and assignment help services. They use their experience, as they have solved thousands of the Matlab Programming assignments, which may help you to solve your complex issues of Matlab Programming. TutorsGlobe assure for the best quality compliance to your homework. Compromise with quality is not in our dictionary. If we feel that we are not able to provide the homework help as per the deadline or given instruction by the student, we refund the money of the student without any delay.
Boost your academic grades and performance by acquiring Greek and Roman Thought Assignment Help. Order now!
Disease and pest resistance and their inheritance tutorial all along with the key concepts of Plant Breeding for Disease Resistance, Breeding for pest resistance, Resistance Breeding before Mendel, Resistance Breeding after Mendel, Four questions regarding pest resistance traits
www.tutorsglobe.com offers preparation of ethers homework help, assignment help, online tutoring assistance, organic chemistry solutions by online qualified tutor's help.
www.tutorsglobe.com offers free fiscal policy tutorial and role of government, answering questions to economics, assignment help and homework help.
Reflection at Plane Surfaces tutorial all along with the key concepts of Laws of reflection, Formation of Image by Plane Mirror, Image Formed by Plane Mirror, second law of reflection
tutorsglobe.com cost-of-living adjustments assignment help-homework help by online intermediate microeconomics tutors
Polysaccharides tutorial all along with the key concepts of Use of Polysaccharides, kinds of Polysaccharides, Structural Polysaccharides, Bacterial polysaccharides, Polysaccharides processed in our Body, Dietary Fiber and Ganoderma Polysaccharide
tutorsglobe.com mechanism of stomatal closing and opening assignment help-homework help by online water transport tutors
Distance and Time Measurement tutorial all along with the key concepts of Origin of elements and composition of universe, composition of Earth, method of Trigonometric Parallaxes, Stellar Parallax and Parallax Formula, Brightness of a Star, Inverse Square Law of Brightness
Theory and lecture notes of General and nested protocols all along with the key concepts of general and nested protocols, two phase commit protocol, nested protocol, Summary of Recovery protocols. Tutorsglobe offers homework help, assignment help and tutor’s assistance on General and nested protocols.
tutorsglobe.com fm radio using cax 1619 and tba 810 ic assignment help-homework help by online electrical engineering tutors
Theory and lecture notes of Central Limit Theorem all along with the key concepts of Central limit theorem, Sampling Distribution, Finite Population Correction Factor. Tutorsglobe offers homework help, assignment help and tutor’s assistance on Central Limit Theorem.
tutorsglobe.com dynamic nature of cell assignment help-homework help by online cell tutors
tutorsglobe.com introduction to the chemistry of benzene assignment help-homework help by online access chemistry tutors
online taks-teks exam preparation course and online taks-teks tutoring package offered by tutorsglobe are the most comprehensive and customized collection of study resources on the web, offering best collection of taks-teks practice papers, quizzes, taks-teks test papers, and guidance.
1948318
Questions Asked
3689
Tutors
1445131
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!