Polynomes can be in fraction form. Finding out the roots of these kinds of polynomes can be very tough with hand in calculus. In Matlab®, you can do it in a very basic way with the ‘residue()’ command. Here, we explained how to find the roots of fraction polynomials in Matlab® with the ‘residue()’ command, with a very basic example below.
How To Use ‘residue()’ Command In Matlab®?
There are two cases to find fraction polynomial roots. The first case is the situation that the degree of numerator polynomial is lower than the degree of the denominator. The second case is the reverse situation of this.
Case when degree of numerator polynomial is more under than denominator polynomial;
>> numerator = [1 2 3]; denominator = [2 -6 4 2 3]; [residuals, roots] = residue(numerator, denominator) residuals = -0.1404 - 0.6146i -0.1404 + 0.6146i 0.1404 - 0.1438i 0.1404 + 0.1438i roots = 1.8111 + 0.7653i 1.8111 - 0.7653i -0.3111 + 0.5396i -0.3111 - 0.5396i >>
In this case, the result will be in the form of; residual1/(x-root1) + residual2/(x-root2) + residual3/(x-root3)…
As you see above, each residual and roots are given at results as shown by red arrows above. From top to down, each number represents related residuals and roots in the above form, from left to right. For example, residual1 = -0.1404 + 0.6146i, root1 = 1.8111 + 0.7653i. Logic is the same for other roots and residuals.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
You need to understand the logic of the definition of polynomials in Matlab®. Numerators and denominators of fraction polynomials are also polynomials, and these polynomials are represented by vectors named ‘numerator’ and ‘denumerator’ as above. You can give other names such as ‘a’ and ‘b’ to these vectors in Matlab®. For example, the ‘numerator’ vector represents the polynomial of x^2+2x+3. All the coefficients of this polynomial are at the ‘numerator’ vector from left to right. This logic is the same for all polynomials defined in Matlab.
The use of the ‘residue()’ command in Matlab® is very easy. You need to define result variables like above such as ‘residuals’ and ‘roots’ into the brackets as shown above. You can give other names to these variables. You need to equalize that with the residual() command, and you need to type the ‘numerator’ and ‘denumerator’ vectors into this command as shown above.
The case when degree of numerator polynomial is bigger than denominator polynomial;
>> numerator = [1 2 3 4 6 6 6]; denominator = [2 -6 4 2 3]; [residuals, roots, integer] = residue(numerator, denominator) residuals = 9.9981 - 5.8397i 9.9981 + 5.8397i 0.2519 - 0.2343i 0.2519 + 0.2343i roots = 1.8111 + 0.7653i 1.8111 - 0.7653i -0.3111 + 0.5396i -0.3111 - 0.5396i integer = 0.5000 2.5000 8.0000 >>
In this case, the degree of ‘numerator’ is bigger than ‘denumerator’ as shown above in Matlab®. The result will be in the form of in this case;
(integer1)x^2 + integer2)x + integer3 + residual1/(x-root1) + residual2/(x-root2) + residual3/(x-root3)…
The difference is the integers represent the section of integer divisions because of the degree gap between ‘numerator’ and ‘denumerator’. To see these integers, you need to add, another result variable, for example like above.
All the integers are shown at that result, that you can see the integer division section of all results. The residual and root section is the same as case 1.
The use of the ‘residue()’ command is very easy and helpful in Matlab®. Do not forget to leave your comments and questions about the ‘residual()’ command in Matlab® below. Your feedback is very important for us.
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.