You are on page 1of 6

ECE424FL: FEEDBACK CONTROL SYSTEMS --> Hs/Ps

// divides H(s) by P(s)


INTRODUCTION TO SCILAB
The SCILAB operations do not always result to
1. Read the SCILAB Help for the following functions simplified rational polynomials. SCILAB does not
and note the use and syntax in using each of them. automatically cancel factors that are common to
poly( ) both the numerator and denominator due to
numer( ) numerical differences . In some cases, rational
denom( ) polynomials can be simplified using simp( ).
coeff( )
roots( ) 4. Extracting the numerator and denominator of a
factors( ) rational polynomial
horner( ) -->Psnum=numer(Ps)
derivat( ) // extracts the numerator of P(s) and assigns it to
simp( ) // Pnum(s)
-->Psden=denom(Ps)
2. Declaring a polynomial and a rational polynomial // extracts the denominator of P(s) and assigns it
--> s=poly(0,'s') // to Pden(s)
// declares s as a variable for polynomials
--> Hs=3*s^3-4*s^2+s+10 5. Extracting the roots of a polynomial
3 2 -->roots(Hs)
// declares the polynomial H(s)=3s -4s +s+10
--> Ps=(4*(s-1))/((s+2)*(s-3)*(s+5)) // extracts the roots of the polynomial H(s) and
// declares the rational polynomial Ps // assigns the roots to the temporary variable
// 4(s-1) // ans
// P(s) = --------------------- -->PsnumRoots=roots(numer(Ps))
// (s-1)(s-3)(s+5) // extracts the roots of the numerator of P(s)
// and assigns the roots to PsnumRoots
3. Adding, Subtracting, Multiplying, and Dividing
Polynomials and Rational Polynomials 6. Factoring a polynomial
addition: + -->[FactorsHs, gHs]=factors(Hs)
subtraction: - // returns the constant factor gHs and the other
multiplication: * // factors in the form (s+k) for real roots and in
division: / // the form (s^2+k1s+k2) for pairs of complex
// conjugate roots
--> Ps+ Hs
// adds P(s) and H(s)
-->[FactorsPsnum, FactorsPsden,gPs]=factors(Ps) [PRACTICE PROBLEM 1]
// returns the numerator constant factor gPs, the Given the rational polynomial
// factors of the numerator which are assigned to 4 3 2
3s + 6s - 21s - 54s -54
// FactorsPsnum, and the factors of the P(s) = ------------------------------------------
// denominator which are assigned to 4 3 2
// FactorsPsden s + 2s + 5s + 4s + 40

7. Evaluating a polynomial (a) Express P(s) in factored form.


-->horner(Hs,5) (b) Evaluate P(s) at s=10
// evaluates H(s) at s=5 (c) Evaluate P(s) as s→∞
(d) Evaluate P'(s) at s=10
-->sv=[0 1 2 3] (e) Evaluate P''(s) at s=0
-->A=horner(Ps,sv)
// evaluates the rational polynomial P(s) at the Since SCILAB is a numerical tool, ∞ (infinity) could
// values of s specified in sv and returns the mean the highest possible value or a relatively
// evaluated values as an array with one-to-one extremely high value, say, 10^16. In the same sense,
// correspondence with the values in sv sometimes you get numerical values like 1.00D-16
-16
which is 1.00x10 which is an extremely low value,
-->w=poly(0,'w') then it can be seen as being equal to 0.
-->Pw=horner(Ps, w*%i)
// evaluates P(s) at s=jw and returns a
// polynomial P(w). The imaginary operator j or i LAPLACE TRANSFORMS
// is the special variable %i in SCILAB
1. Determining the Laplace transform from a look-up
8. Derivative of a polynomial table and then simplifying the Laplace transform
-->Hsprime=derivat(Hs) using SCILAB.
// determines the first derivative of H(s) and
// assigns the derivative polynomial to H'(s) Let: x(t) = {3 - te
-4t -2t
+ 5e cos(4t)} u(t)
-->Psprime2=derivat(derivat(Ps))
// determines the second derivative of P(s) and from a table of Laplace Transform pairs
// assigns it to P''(s)
3 1 5(s+2)
X(s) = --- - ---------- + ------------------
2 2 2
s (s+4) (s+2) +4

then X(s) is simplified using SCILAB


-->s=poly(0,'s') With the denominator in factored form,
-->A=3/s 4 3 2
s + 15s + 45s +63s + 60
-->B=1/(s+4)^2 X(s) = ---------------------------------------------
-->C=5*(s+2)/((s+2)^2+4^2) 2 2
-->Xs=A-B+C (1) (s+2) (s +2s+5) (s +4s+5)

2 Plotting the time-domain graph using x(t) and X(s) //Determine the roots of the denominator
-->t=(10^(-10)): 0.01:10; -->RXsd=roots(denom(Xs))
-->x=3-t.*exp(-4*t)+5*exp(-2*t).*cos(4*t);
-->clf; plot2d(t,x); xgrid(); With the denominator factored in terms of the roots
// plots x(t) for 0<t ≤10
4 3 2
s + 15s + 45s +63s + 60
// Plotting x(t) using its Laplace transform X(s) X(s) = ----------------------------------------------------
-->t=(10^(-10)): 0.01:10; (s+2)(s+1-j2)(s+1+j2)(s+2-j1)(s+2+j1)
-->x=csim('impulse', t, tf2ss(Xs));
-->plot2d(t,x); xgrid; The partial fraction expansion of X(s) is
// plots x(t) for 0 < t ≤ 10 from X(s)
A1 A2 A3
Note that effectively there is only one plot X(s) = -------- + ---------- + -----------
because the two plots coincided exactly. (s+2) (s+1-j2) (s+1+j2)

3. Performing Partial Fraction Expansion on an X(s) A4 A5


with singular roots only and then using a look-up + ---------- + ------------
table to obtain x(t) (s+2-j1) (s+2+j1)

4 3 2 All the roots are singular and no root is repeated


Xn(s) s + 15s + 45s +63s + 60
X(s) = -------- = -------------------------------------------- such that A1 to A5 can be determined using the
5 4 3 2 Residue method. For example, to compute for A1
Xd(s) s + 8s +30s +66s +85s + 50 and A2,
//Declare X(s) Xn(s)
-->s=poly(0,'s') A1 = ----------- evaluated at s=-2
-->Xsn=s^4+15*s^3+45*s^2+63*s+60 Xd'(s)
-->Xsd=s^5+8*s^4+30*s^3+66*s^2+85*s+50
-->Xs=Xsn/Xsd Xn(s)
//Factor the denominator A2 = ----------- evaluated at s=-1+j2
-->[FXsd,gXsd]=factors(denom(Xs)) Xd'(s)
//Determine A1 to A5 Manipulating X(s) to conform to entries in Laplace
-->Rs=Xsn/derivat(Xsd) transforms tables
-->A1=horner(Rs, -2)
-->A2=horner(Rs, -1+2*%i) 2 3(s+1) -2 -4(s+2) +8
-->A3=horner(Rs, -1- 2*%i) X(s) = -------- + ----------------- + -----------------
-->A4=horner(Rs, -2+%i) 2 2 2 2
(s+2) (s+1) +2 (s+2) +1
-->A5=horner(Rs, -2-%i)
The Inverse Laplace transform of X(s) is
Thus, the expanded form of X(s) now is -2t -t -t
x(t) = { 2e + 3e cos(2t) - e sin(2t)
-2t -2t
2 1.5+j0.5 1.5-j0.5 - 4e cos(t) + 8e sin(t) } u(t)
X(s) = -------- + ------------ + -----------
(s+2) (s+1-j2) (s+1+j2) 4. Performing Partial Fraction Expansion on an X(s)
with repeated roots and then using a look-up
-2-j4 -2+j4 table to obtain x(t)
+ ---------- + ------------
(s+2-j1) (s+2+j1) Xn(s)
4 3 2
5s + 29s + 100s + 132s + 96
X(s) = -------- = -----------------------------------------------
5 4 3 2
// Simplify the sum of the 2nd and 3rd terms Xd(s) s + 6s + 16s + 32s + 48s + 32
// because their roots are complex-conjugates
// and the two terms should form a single term with //Declare X(s)
// a quadratic denominator -->s=poly(0,'s')
-->(A2/(s+1-2*%i)) + (A3/(s+1+2*%i)) -->Xsn=5*s^4+29*s^3+100*s^2+132*s+96
//Simplify the sum of the 4th and 5th term -->Xsd=s^5+6*s^4+16*s^3+32*s^2+48*s+32
-->(A4/(s+2-%i)) + (A5/(s+2+%i)) -->Xs=Xsn/Xsd
//Factor the denominator
The final expanded form of X(s) is -->[FXsd,gXsd]=factors(denom(Xs))

2 3s+1 -4s With the denominator in factored form,


X(s) = -------- + -------------- + -------------
4 3 2
2
(s+2) (s +2s+5) (s +4s+5)
2 5s + 29s + 100s + 132s + 96
X(s) = ---------------------------------------------
2 3
(1) (s +4) (s+2)
// Determine the roots of the denominator A3, A4, and A5 are computed using
-->RXsd=roots(denom(Xs)) Heaviside's formula as follows:

With the denominator factored in terms of the roots 3


A3 = (s+2) X(s) evaluated at s=-2
Xn(s)
4 3 2
5s + 29s + 100s + 132s + 96 = ----------- evaluated at s=-2
X(s) = ---------------------------------------------------- 2
s +4
(s-j2)(s+j2)(s+2)(s+2)(S+2)

The partial fraction expansion of X(s) is d


3
A1 A2 A3 A4 = ---- (s+2) X(s) evaluated at s=-2
X(s) = -------- + ---------- + ----------- ds
3
(s+j2) (s-j2) (s+2) d Xn(s)
= ---- --------- evaluated at s=-2
A4 A5 2
+ ---------- + --------- ds s +4
2
(s+2) (s+2)
2
A1 and A2 can be computed using the residue 1 d
3
method. A5 = -- ---- (s+2) X(s) evaluated at s=-2
2
2 ds
//Determine A1 to A5
-->Rs=Xsn/derivat(Xsd) 2
-->A1=horner(Rs, 2*%i) 1 d Xn(s)
-->A2=horner(Rs, -2*%i) = -- ----- -------- evaluated at s=-2
2 2
// Simplifying the first 2 terms 2 ds s +4
-->(A1/(s+2*%i))+(A2/(s-2*%i))
// Determining A3, A4, and A5
At this point, -->Hs=Xsn/(s^2+4)
-->A3=horner(Qs,-2)
3s+8 A3 A4 A5 -->A4=horner(derivat(Qs),-2)
X(s) = ---------- + --------- + --------- + --------- -->A5=horner((1/2)*derivat(derivat(Qs)),-2)
2 3 2
s +4 (s+2) (s+2) (s+2)
The final expanded form of X(s) is

3s+8 10 -5 2
X(s) = ---------- + --------- + --------- + ---------
2 3 2
s +4 (s+2) (s+2) (s+2)

The inverse Laplace transform of X(s) is


2 -2t -2t -2t
x(t) = {3cos(2t)+4sin(2t)+5t e -5te + 2e } u(t)

[PRACTICE PROBLEM 2]
Obtain the Partial Fraction expanded form and then
determine the inverse Laplace transform of the
following Laplace transforms.

4 3 2
7s + 75s + 280s + 572s +784
(a) X(s) = ------------------------------------------------------
5 4 3 2
s + 11s + 48s + 104s + 176s + 240

5 4 3 2
10s + 42s + 61s + 40s + 20s + 4
(b) X(s) = -----------------------------------------------------
6 5 4 3 2
s + 5s + 9s + 7s + 2s

You might also like