5. Use matlab to complete the transposition of the symbolic matrix and the power operation of the symbolic square matrix (matlab program)

1. Brief description

      

Matrix transpose in Matlab symbolic operation

transpose a vector or matrix

B = A.'
B = transpose(A)
Explanation

B = A.' returns the nonconjugate transpose of A, that is, the row and column indices of each element are swapped. If A contains complex elements, A.' does not affect the sign of the imaginary part. For example, if A(3,2) is 1+2i and B = A.', then element B(2,3) is also 1+2i.

B = transpose(A) is another way of doing A.', which enables operator overloading for a class.

The complex conjugate transpose operator A' also negates the sign of the imaginary part of the complex elements in A.

The two commands have the same effect, pay attention to adding a "." to the first command. Usually, the real number matrix is ​​usually transposed by A', which is the conjugate transposition. There is no difference in real number operations, but there is a difference in imaginary numbers.

For symbolic operations, when performing matrix or vector transposition, the conjugate transpose command will be "conj(a)" in the matrix after transposition, so symbolic operations cannot be continued.
 

2. Code

%% Learning objective: Transpose of matlab symbolic matrix

clear all;
A1=sym(magic(4))
B1=A1' % If it is a complex number, it is a conjugate transpose
C1=A1.' % The real transpose
A2=sym([6+6i,6;6-6i ,6])
B2=A2'
C2=A2.'


%% Learning objective: power operation of matlab symbolic square matrix

clear all;
a=sym('[x 4*x 4;4 4 x;4.0 x 4]')
y1=a^2
b=sym('[4 8;4 7]')
y2=2^b

3. Running results

 

 

Guess you like

Origin blog.csdn.net/m0_57943157/article/details/132241035