Sie sind auf Seite 1von 10

Math Review with Matlab:

Solving Algebraic
Equations
Single Variable
Transcendental Equations
S. Awad, Ph.D.
M. Corless, M.S.E.E.
D. Cinpinski
E.C.E. Department
University of Michigan-Dearborn
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Solving Transcendental
Equations
 Solve Command
 Polynomial Transcendental Example
 Poly2sym Command
 Exponential Transcendental Example
 Complex Solution Example
2
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Solve Command
 The Symbolic Toolbox’s solve command is used to
solve both transcendental and algebraic equations

 solve(f) solves f in terms of the independent symbolic


variable closest to x. f must be a symbolic expression
or a entered as a text string enclosed by single quotes

 solve(f1,f2,...,fn) is used to solve multiple


equations by separating the symbolic equations by
commas as follows
3
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Polynomial Transcendental
Equation Example
 Use Matlab’s » syms x
Symbolic Toolbox » xs_sym=solve(x^2-3*x+2)
solve command
xs_sym =
to solve the
[ 1]
transcendental
equation:
[ 2]
» xs_dbl=double(xs)
x  3x  2  0
2 xs_dbl =
1 x1  1
2 x 2 2
4
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Poly2Sym Command
 The poly2sym(f) command converts a polynomial
coefficient vector to symbolic polynomial expression in
terms of the default symbolic variable x

 The poly2sym(f,'v') command converts a polynomial


coefficient vector to symbolic polynomial expression in
terms of the symbolic variable v

 The sym2poly command converts a symbolic


polynomial expression to a polynomial coefficient
vector
5
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Poly2sym Example
 Example: y  5x  2 x  x  x  10
4 3 2

» p=[5,2,-1,1,10]; Polynomial
» sym_exp=poly2sym(p) Vector

sym_exp = Symbolic
5*x^4+2*x^3-x^2+x+10 Expression
» poly_vec=sym2poly(sym_exp)

poly_vec =
Polynomial
5 2 -1 1 10 Vector
6
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Exponential Transcendental
Equation Example
Use the solve command to solve
e 2 x  3e x  54  0

the transcendental equation:


» xs_sym=solve(exp(2*x)+3*exp(x)-54)
xs_sym =
[ log(-9)]
[ log(6)]
» xs_dbl=double(xs)
xs_dbl =
2.1972 + 3.1416i Complex Solution
1.7918 Real Solution
7
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Verify Loge(-9)
 In Matlab, log is the
natural log of base e:
log e    ln(  )

 Verify ln(-) is a     e j
complex number :
 
ln  e j  ln   ln e j  
 ln   j ln e 
 
ln  e j  ln   j

 In this case
- = -9, so: ln( 9)  2.1972  j 3.1416
8
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Complex Solution Example


x e 5  0
 Solve the nonlinear equation: 2 x
 Verify the result
» syms x
» rt = solve('x^2+exp(x)+5')
rt =
3.5668799472626199482146544957277+
4.8873680198538466074569067078051*i

» z=subs('x^2+exp(x)+5',rt)
z =
30
.2e-30 z  0.2  10 0
9
Solving Algebraic Equations: Transcendental Equations
Math Review with Matlab U of M-Dearborn ECE Department

Summary
 The solve command can be used to solve
symbolic transcendental equations with real or
complex solutions

 poly2sym and sym2poly commands can be


used to convert polynomial vectors to/from
symbolic expressions

10

Das könnte Ihnen auch gefallen