Solving sets of equations with the Symbolic Toolbox

The MATLAB Symbolic Toolbox also enables you to solve equations in which the coefficients are symbolic expressions. The command with which symbolic (not necessarily linear) equations can be solved is solve. This command is used as follows:

>> solve('expression1','expression2','unknown1','unknown2')

Here expression1 and expression2 are equations, and unknown1 and unknown2 are the variables that need to be solved from these equations. For example:
>> syms a b c d p q
>> [x1,x2] = solve('a*x1+b*x2=p','c*x1+d*x2=q','x1','x2')

x1 =
    (-b*q+p*d)/(-b*c+d*a)
x2 =
    (-c*p+q*a)/(-b*c+d*a)}
More detailed information about this command can be obtained through the online help.



Previous      Next      Up      Contents


Esteur 2010-03-22