|
|
|
The Hilbert matrix is a certain kind of matrix. You do not need to know its definition right now. The important thing to note is that, if a matrix is too big to fit on the screen, MATLAB will break it up into smaller sections for display.
Note that MATLAB uses the colon as a "wild card." A(4, : ) means "A (4, anything)," or the elements of matrix A, in row 4, and all the columns – so you get all of row 4 of A. Similarly, A(:,1) represents column 1 of A.
Enter
2 : 7
and write a comment to describe what happens.
2 : 3 : 8
and describe the result.
1 : 2 : 10
Did you get what you expected?
A ( : , 2:4)
R = [2 3 6
4 4 4]
Enter
S = [1 0 0
0 1 0]
Enter
T = [4 -1
2 1
0 5]
R' % Transpose
T'
2 * R
and describe what happens.
2R
and describe what happens.
R + S
R - S
S*T
Enter
T*S
Enter
ST
Remember that you must always use an asterisk to indicate multiplication –
of one real number by another, or of a matrix by a constant, or of a matrix
by another matrix.
R*S
What happens?
U = [1 2 3; 0 2 3; 0 0 3]
and note what happens. You may use this shortcut method for entering matrices
if you like.
I_4 = eye(4)
I_6 = eye(6)
Z_2 = zeros(2)
Z_5 = zeros(5)
These matrix definitions are built into MATLAB; you may use them whenever
you need these special matrices.
|
|
|
modules at math.duke.edu | Copyright CCP and the author(s), 2000 |