Practical 7

The Symbolic Toolbox

The past practicals have introduced MATLAB as a powerful programmable graphics calculator. Now we will start showing you how, using MATLAB Symbolic Toolbox, you can, not only solve equations, but also perform algebraic manipulations, such as differential and integral calculus like finding the derivative  analytically.

 

> Exercise: Introducing the Symbolic Toolbox

> Type in the following commands.

clear all

sin(x)

>What error message is displayed?

The reason for this error message is that you have not first given x a value. However, if we make x a symbolic variable by using the syms x command, then we will be able to create and manipulate formulae without giving x a value first.

> Type in the following and see if you still get the same error message.

syms x

sin(x)

The syms command is actually a shortcut for the sym command. The longer way of writing is:

sym(‘x’)

> Exercise: Symbolic Variables

> Type in the following and decide which variables are symbolic.

syms x

y = x + 1.4*sqrt(x+3) + 5.49

pretty(y)

>What does the pretty command do here?