In this demonstration, we'll look at how to manipulate symbolic variables in Matlab. These techniques will allow you to use Matlab to carry out algebraic calculations, instead of doing them by hand. In Matlab we can define symbolic variables with the commands sims. For example, we can define the variables a and b. Here the real parameter, at the end of the list, signifies that we want our variables to be restricted to real numbers. In this course, we will only work with real values. Now we can perform algebraic operations with a and b. For example, we can define the variable x equals a plus b squared. We can then use expand to expand this binomial. Algebraic operations are automatically simplified. For example, if we define the following y. We see that Matlab automatically simplifies the expression for us. We can further use trigonometric functions as well. For example, we can define z equals sine a squared plus cosine a squared. The simplify command will simplify an expression using known identities. In this case, we know that sine squared plus cosine squared is one. We can further define matrices in terms of functions of the variables a and b. For example, we can define the following matrix a. And the following matrix b. We can manipulate these matrices as if they were regular numeric matrices. For example, we can multiply the matrices a and b together. We can find the transpose of a, and we can also find the eigenvectors and eigenvalues. Here the eigenvalues of the matrix a are along the diagonal of this matrix d. And the corresponding eigenvectors are in the columns of the matrix v. We can also find the inverse, and the determinant. These capabilities are particularly useful when manipulating rotation matrices. For example, suppose we wanted to find the zyz rotation matrices, presented in lecture, in terms of the angles phi around z, the rotation theta around y, and psi around z again. We first define these angles of rotation. We then define three matrices, one for each simple rotation. We define r1 to represent the simple rotation of c about z. We define a second matrix, r2, to represent the rotation theta around y. And finally, we can define the rotation r3 about z again. We can easily compose these rotations together with one command. You can verify that the rotation matrix is the same expression that we saw in lecture. These operations will help you throughout this course.