View
215
Download
0
Category
Tags:
Preview:
Citation preview
Solving AlgebraicEquations
S. Awad, Ph.D.
M. Corless, M.S.E.E.
D. Cinpinski
E.C.E. Department
University of Michigan-Dearborn
Math Review with Matlab:
Algebraic Equations with Multiple Variables
U of M-Dearborn ECE DepartmentMath Review with Matlab
2
Solving Algebraic Equations: Multiple Variables
Solving Algebraic Equations
with Multiple Variables
Solve Command for Equations of Multiple Variables
Single Equation of Two Variables Example
Two Variable Complex Solution Example
System of Equations Example
System of Equations with Symbolic Constant Example
U of M-Dearborn ECE DepartmentMath Review with Matlab
3
Solving Algebraic Equations: Multiple Variables
The solve command can be used to solve symbolic expressions with more than one variable:
Solve Command for Equations of Multiple Variables
solve(f) solves the symbolic expression f using the symbolic variable closest to x as the independent variable
solve(f, v) solves the symbolic expression f in terms of the independent variable v
U of M-Dearborn ECE DepartmentMath Review with Matlab
4
Solving Algebraic Equations: Multiple Variables
Single Equation of Two Variables Example
Given the equation: 0242 bcb
1) Find the solution of the equation assuming that c is the solution variable
2) Find the solution of the equation assuming that b is the solution variable
U of M-Dearborn ECE DepartmentMath Review with Matlab
5
Solving Algebraic Equations: Multiple Variables
Solve for c as the independent variable c is the default variable since it is closest to x
Default Solution
» syms b c» f=b^2+4*c+2*b;» sol_c=solve(f)
24
2 bbc
0242 bcb
sol_c = -1/4*b^2-1/2*b
U of M-Dearborn ECE DepartmentMath Review with Matlab
6
Solving Algebraic Equations: Multiple Variables
Solve for b
» sol_b=solve(f,b)
cb
cb
411
411
2
1
Solve for b as the independent variable b must be explicitly specified on the command line
0242 bcb
sol_b =[ -1+(1-4*c)^(1/2)][ -1-(1-4*c)^(1/2)]
U of M-Dearborn ECE DepartmentMath Review with Matlab
7
Solving Algebraic Equations: Multiple Variables
Given the equation of two variables:
Two Variable Complex Solution Example
09 42 yx Solve for x in terms of y using Matlab:
» syms x y» xs=solve(x^2+9*y^4)xs =[ 3*i*y^2][ -3*i*y^2]
Roots are
Complex Conjugates
U of M-Dearborn ECE DepartmentMath Review with Matlab
8
Solving Algebraic Equations: Multiple Variables
System of Equations Example
Solve the system of consistent linear equations:
2
11
12
22
32
23
321
321
321
xxx
xxx
xxx
» syms x1 x2 x3» f1='3*x1-x2+2*x3=12';» f2='x1+2*x2+3*x3=11';» f3='2*x1-2*x2+x3=2';» [x1 x2 x3]=solve(f1,f2,f3) x1 = 7x2 = 5x3 = -2
2
5
7
3
2
1
x
x
x
U of M-Dearborn ECE DepartmentMath Review with Matlab
9
Solving Algebraic Equations: Multiple Variables
System of Equations with Symbolic Constant Example
Solve the two equations:ayx 6932 yx
» syms x y a» s=solve(x+6*y-a,2*x-3*y-9)
s = x: [1x1 sym]
y: [1x1 sym]
s is a structure
x and y are independent variables a is a constant
U of M-Dearborn ECE DepartmentMath Review with Matlab
10
Solving Algebraic Equations: Multiple Variables
The solution is a structure with named fields x and y representing symbolic expressions
Viewing Structures
s = x: [1x1 sym] y: [1x1 sym]
» xs=s.xxs =18/5+1/5*a
» ys=s.yys =-3/5+2/15*a
View each symbolic expression separately
Expressions are in terms of symbolic variable a
U of M-Dearborn ECE DepartmentMath Review with Matlab
11
Solving Algebraic Equations: Multiple Variables
Summary The solve command can be used to solve:
A single equation in terms of an independent variable
A system of multiple consistent equations
A system of equations having symbolic variables and symbolic constants
Recommended