Page 239 -
P. 239
0.9708 0 0 0
0.9901 0.2140 0 0
0.7889 0.6435 0.4120 0
0.4387 0.3200 0.7446 0.6833
• The single quotation mark (‘) after the name of a matrix changes
the matrix rows into becoming its columns, and vice versa, if the
elements are all real. If the matrix has complex numbers as ele-
ments, it also takes their complex conjugate in addition to the
transposition.
• Other specialized matrices, including the whole family of sparse
matrices, are also included in the MATLAB library. You can find
more information about them in the help documentation.
8.1.1.3 Functional Construction of Matrices
The third method for generating matrices is to give, if it exists, an algorithm
that generates each element of the matrix. For example, suppose we want to
generate the Hilbert matrix of size (n ⊗ n), where n = 4 and the functional
1
form of the elements are: M = . The routine for generating this
mn mn+
matrix will be as follows:
M=zeros(4,4);
for m=1:4
for n=1:4
M(m,n)=1/(m+n);
end
end
M
• We can also create new matrices by appending known matrices.
For example:
Let the matrices A and B be given by:
A=[1 2 3 4];
B=[5 6 7 8];
We want to expand the matrix A by the matrix B along the horizontal (this is
allowed only if both matrices have the same number of rows). Enter:
C=[A B]
© 2001 by CRC Press LLC