Accelerating the pace of engineering and science

# Symbolic Math Toolbox

## Plane Rotations

This example shows how to do plane rotations using Symbolic Math Toolbox™.

Create a symbolic variable named t.

```t = sym('t') ```
``` t = t ```

Create a 2-by-2 matrix representing a plane rotation through an angle t.

```G = [ cos(t) sin(t); -sin(t) cos(t)] ```
``` G = [ cos(t), sin(t)] [ -sin(t), cos(t)] ```

Compute the matrix product of G with itself.

```G2 = G*G ```
``` G2 = [ cos(t)^2 - sin(t)^2, 2*cos(t)*sin(t)] [ -2*cos(t)*sin(t), cos(t)^2 - sin(t)^2] ```

This should represent a rotation through an angle of 2*t. Simplification using trigonometric identities is necessary.

```G2 = simplify(G2) ```
``` G2 = [ cos(2*t), sin(2*t)] [ -sin(2*t), cos(2*t)] ```

G is an orthogonal matrix; its transpose is its inverse.

```E = G.'*G E = simplify(E) ```
``` E = [ cos(t)^2 + sin(t)^2, 0] [ 0, cos(t)^2 + sin(t)^2] E = [ 1, 0] [ 0, 1] ```

What are the eigenvalues of G?

```e = eig(G) ```
``` e = cos(t) - sin(t)*1i cos(t) + sin(t)*1i ```

Apply the simplification rules.

```e = simplify(e) ```
``` e = cos(t) - sin(t)*1i cos(t) + sin(t)*1i ```