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.
TutorsGlobe.com Nucleus and Radioactivity Assignment Help-Homework Help by Online Access Chemistry Tutors
We bring you the best SPSS Assignment Help service from the cluster of qualified tutors at viable prices to attain A++ grades.
tutorsglobe.com significance of natural vegetative propagation assignment help-homework help by online natural methods of vegetative propagation tutors
tutorsglobe.com mechanism of muscle contraction assignment help-homework help by online muscles tutors
tutorsglobe.com calorie values assignment help-homework help by online nutrition tutors
The embryo builds up into an adult plant along with roots, stem and leaves because of the activity of the apical meristem.
let phd tutors from financial management essay writing assignment help complete your essay to secure a++ at reasonable rates.
www.tutorsglobe.com offers preparation of carboxylic acids homework help, preparation of carboxylic acids assignment help, online tutoring assistance, organic chemistry solutions by online qualified tutor's help.
Tissue system is a group of tissues that performing an identical function irrespective of its position in the plant body.
Influence of man on the Environment tutorial all along with the key concepts of Man and the Environment, Pollution, Chemical Pollution, Industrial Pollution, Carbon dioxide and Global Warming, Nuclear Pollution, Deforestation, Loss of Biodiversity
tutorsglobe.com virulent or lytic cycle assignment help-homework help by online life cycle of a phage tutors
efficiency ratios are employed to try to assess how effectively the several resources of the business are managed.
tutorsglobe.com paulings method assignment help-homework help by online calculation of atomic radius tutors
We are offering top-notch Accounting Standards Assignment Help service for students at nominal prices with 24/7 support.
introduction to physical chemistry tutorial all along with the key concepts of where is physical chemistry used, industries where physical chemistry is used and importance of chemistry in everyday life
1945557
Questions Asked
3689
Tutors
1453609
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!