Professional Documents
Culture Documents
Polynomial PDF
Polynomial PDF
Polynomial PDF
< Scilab
Type
6 - 5x + x
-->p2 = poly([6 -5 1], 'x', 'c') In the above polynomial p2 which is same as p1, it
p2 = is observed that, the third parameter, when
2
supplied, may be 'c' or 'coeff' in which case the first
parameter is a vector containing the coefficients of
6 - 5x + x the polynomial, starting from the constant as the
first element and power of the symbolic variable
increasing by one for each element in the vector.
Type
It is possible to perform a number of operations on
-->p1 polynomials, such as, find its roots, add, subtract,
p1 =
2
multiply, divide and simplify.
Recall p1 by typing
6 - 5x + x
-->roots(p1)
ans =
the roots of p1 can be obtained as:
2.
3.
type
-->p2
p2 = Also recall p2
2
6 - 5x + x
type
Now add the two polynomials p1 and p2 and store
-->p3 = p1 + p2
p3 = the result in the polynomial p3.
2
Subtraction can be performed in a similar way.
12 - 10x + 2x
type
Product of two polynomials is also a polynomial, and
-->p4 = p1 * p2
is calculated using the multiplication operator (*).
p4 =
2 3 4
type
-->q1 = 1+x
q1 =
We will define another polynomial say q1 as
1+x
type
-->q2 = 1+2*x+x^2
q2 = and q2 as
2
1 + 2x + x
1+x
type
-->q3 = 1+3*x+2*x^2
q3 =
2
also let us define another polynomial say q3 as
1 + 3x + 2x
type
-->q1/q3
ans =
and divide q1 by q3 as
0.5
-------
0.5 + x
- 5 + 2x
type
-->coeff(p1)
ans = The coefficients of the polynomial p1 can be found
out using the coeff command as
6. - 5. 1.
type
-->horner(p1,0)
ans =
type
-->horner(p1,[0 1 2])
ans =
6. 2. 0.
type
-->factors(p3)
ans =
ans(1) find its factors using the factors() command
- 2 + x
ans(2)
- 3 + x
Type
type
-->factors(q3)
ans =
ans(1)
0.5 + x
ans(2)
1 + x
--> s = %s;
Let us declare 's' as symbolic variable with the
command
Type
-->tf=num/den
Let us now define a variable say 'tf' in the form of
fraction
tf =
1 and
---------
2
2 + 3s + s
type
-->pfe=pfss(tf)
pfe =
pfe(1)
1 perform the partial fraction decomposition
-----
1 + s operation on 'tf' using the 'pfss() command as
pfe(2)
- 1
-----
2 + s
type
Let us retrieve the original transfer function by
-->orig = pfe(1)+pfe(2) adding the output obtained from the pfss()
orig = command
1
--------- which is exactly same as the transfer function we
2 defined using the num and den variables.
2 + 3s + s
We obtain
Slide 5
and
Numerator
Consider an example
Slide 6
This gives the natural frequency
ωn = 2
-->g = 5/(2*s^2+3*s+8)