Practical 7: Symbolic Toolbox

Practical 7

Solving Equations

The Symbolic Toolbox can be used to find solutions for single or simultaneous equations using the solve command.

Solving a Single Equation

The first task is to solve a single equation f \left(x\right)=0 for the variable x, with the result stored in the variable a. This can be done with command solve.

a = solve(f,x)

> Exercise: Using solve for a Single Equation

> Go through and type in the code for the following steps to solve the single equation.

 \frac{10}{x^{3}+1} =4-2x

> Watch out! There is an error that you will need to correct!!

1. Decide what f \left(x\right) is (you will need to rearrange the equation)

In this case

f(x)= \frac{10}{x^{3}+1} -4+2x

2. Create a symbolic variable x syms x
3. Create a symbolic variable f by assigning a symbolic expression to it f=10/(x^3+1)-4+2x
4. Solve f \left(x\right)=0 u = solve(f,x)