Difference between revisions of "Scilab/C2/Matrix-Operations/English"
(Created page with ''''Title of script''': '''Matrix Operations''' Author:Anuradha A,Shalini Shrivasta. Keywords: {| style="border-spacing:0;" ! ! Narration |- | style="border-top:none;borde…') |
PoojaMoolya (Talk | contribs) |
||
Line 8: | Line 8: | ||
{| style="border-spacing:0;" | {| style="border-spacing:0;" | ||
− | ! | + | ! Visual Clue |
! Narration | ! Narration | ||
Revision as of 09:54, 13 June 2014
Title of script: Matrix Operations
Author:Anuradha A,Shalini Shrivasta.
Keywords:
Visual Clue | Narration |
---|---|
Slide 1
[Title slide] |
Welcome to the spoken tutorial on Matrix Operations. |
Slide 2
[Objectives slide] |
At the end of this spoken tutorial, you will be able to:
1. Access the elements of Matrix 2. Determine the determinant, inverse and eigen values of a matrix. 3. Define special matrices. 4. Perform elementary row operations. 5. Solve a system of linear equations using scilab. |
slide 3
[Prerequisites]
|
The preequisites are
|
Launch Scilab | Start Scilab by double-clicking on the Scilab icon present on the Desktop.
|
Scilab Console | Recall that in the Spoken Tutorial, 'Vector Operations', matrix E was defined as
and press enter Let us now see how to address individual elements of a matrix, separately. To access the element in the first row and second column, type:
ans =
|
It is easy to extract an entire row or an entire column of a matrix in Scilab . For example, first row of E can be obtained using the following command:
E1 =
The command returns all the elements of the first row in the order of their appearance in the row. Colon, when used alone, refers to all the elements of row or column, depending upon whether it appears as a first or a second entry respectively inside the bracket. | |
Also, any subset of a matrix can be extracted using a colon (“:”). For example, the set of elements starting from second to third columns of E can be obtained using the following command:
22. 36.
| |
If the size of the matrix is not known $ symbol can be used to extarct the last row or column of that matrix. For example to extract all rows of the last column of the matrix E, we will type
A as
ans =
| |
To calculate the inverse and the eigenvalues of a matrix, the commands, “inv” and “spec” respectively, can be used. For example:
ans =
- 1. - 1. 1. 0. - 0.5 1. --> spec(A) gives the eigen values of A ans =
0.3959319 1.3488942
Square or cube of a square matrix A can be calculated by simply typing A^2 or A^3 respectively. A caret symbol is used to raise a matrix to power, like in ordinary arithmetic operations. In our keyboard, it is obtained by pressing shift+6.
ans =
6. 20. - 10.
-->A^3 ans =
- 24. - 78. 44. - 10. - 32. 20.
| |
Slide 5
[Execise Slide] |
Please pause the tutorial now and attempt exercise number one given with the video.
2.Extract the second column of A 3. Determine the determinant and eigenvalues of the matrix, A^2+2*A |
Certain special matrices can also be created in Scilab:
ans =
0. 0. 0. 0. 0. 0. 0. 0.
ans =
1. 1. 1. 1.
1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1.
0.7560439 0.3303271 0.6283918
| |
In linear systems, one of the important sets of operations a user carries out on matrices are the elementary row and column operations.These operations involve executing row operations on a matrix to make entries below a nonzero number, zero. This can be done easily in Scilab.
P =
| |
The procedure can be extended to larger systems and to other forms of elementary column operations.
T =
0. - 3. - 6. 5. 5. - 2.
A =
- 2. - 6. 4. - 1. - 3. 3.
b =
- 2. 1.
x =
2. 2.
x =
2. 2.
ans =
0. 0.
It is possible that in some systems the above verification exercise may not yield a matrix with *exact* zeros as its elements due to intermediate floating point operations. However, one will indeed get a very small number, typically of the order of 10-16. | |
Slide 5 | Please pause the tutorial now and attempt exercise number two given with the video.
1. Define a 3x3 matrix A with all elements equal to 1. Multiply 1st and 2nd row with scalars, 3 and 4 respectively, and determine the determinant of the resultant matrix.
Use a suitable sequence of row operations on A to bring A to upper triangular form.
2x + 5y − z − 9w=-3 2x + y − z + 3w=-11 x − 3y + 2z + 7w=-5
b) Verify the solution of part (a). |
Slide 7 | This brings us to the end of this spoken tutorial on Matrix Operation.
There are many other functions in Scilab which will be covered in other spoken tutorials. Keep watching the Scilab links. Summary: In this tutorial we have learnt
This is Anuradha Amrutkar from IIT Bombay signing off. Thank you for joining. Goodbye.
|