Basic Algebraic Operations
Basic algebraic operations on symbolic objects are the same as operations on MATLAB®objects of classdouble
. This is illustrated in the following example.
The Givens transformation produces a plane rotation through the anglet
. The statements
syms t G = [cos(t) sin(t); -sin(t) cos(t)]
create this transformation matrix.
G = [ cos(t), sin(t)] [ -sin(t), cos(t)]
Applying the Givens transformation twice should simply be a rotation through twice the angle. The corresponding matrix can be computed by multiplyingG
by itself or by raisingG
to the second power. Both
A = G*G
and
A = G^2
produce
A = [ cos(t)^2 - sin(t)^2, 2*cos(t)*sin(t)] [ -2*cos(t)*sin(t), cos(t)^2 - sin(t)^2]
Thesimplify
function
一个=简化(A)
uses a trigonometric identity to return the expected form by trying several different identities and picking the one that produces the shortest representation.
A = [ cos(2*t), sin(2*t)] [ -sin(2*t), cos(2*t)]
The Givens rotation is an orthogonal matrix, so its transpose is its inverse. Confirming this by
I = G.' *G
生产
I = [ cos(t)^2 + sin(t)^2, 0] [ 0, cos(t)^2 + sin(t)^2]
and then
I = simplify(I)
I = [ 1, 0] [ 0, 1]