Working With Reciprocal of Polynomials

8 views (last 30 days)
Hello, this is my first post in this form and I am new to MatLab. I would like to take the reciprocal of a polynomial in factored form and express the answer in polynomial form. For example, I wish to convert 10/((x+3)^2(x+5)) in regular polynomial form.
  4 Comments
Daniel
Daniel on 25 Aug 2024
I think maybe I am asking Matlab to perform something that can’t be done. I want to divide a number by an expression that is in factored form and assign the answer to a variable. I thought using the poly command provides the coefficients of a polynomial and also is the expression itself. But results of the poly command simply outputs an array of numbers. I just may be going about this in the wrong way.
Torsten
Torsten on 25 Aug 2024
Edited: Torsten on 25 Aug 2024
syms x
p = (x+3)^2*(x+5)
p = 
expand(p)
ans = 
coeffs(p)
ans = 
What do you want to do next ?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 25 Aug 2024
Moved: Sam Chak on 26 Aug 2024
It is difficult to tell what you want?
syms x
f = 10/((x+3).^2.*(x+5))
f = 
[N, D] = numden(f)
N = 
10
D = 
C = coeffs(D, x)
C = 
poly2sym(C, x)
ans = 
tf(double(N), double(C))
ans = 10 -------------------------- 45 s^3 + 39 s^2 + 11 s + 1 Continuous-time transfer function.
  3 Comments
Sam Chak
Sam Chak on 26 Aug 2024
Given that you found the suggested solution helpful and your problem has been resolved, please consider clicking "Accept" on the answer to close the issue. This helps provide closure and mark the question as answered for the benefit of the community.

Sign in to comment.

More Answers (1)

Naga
Naga on 25 Aug 2024
Edited: Walter Roberson on 25 Aug 2024
Hello Daniel,
To convert a polynomial in factored form to regular polynomial form, you can use the poly function in MATLAB. Here's an example:
% Define the factored polynomial
num = 10;
den = conv(conv([1 3], [1 3]), [1 5]);
% Convert to regular polynomial form
coeffs = num * poly(den)
coeffs = 1x5
10 -960 27740 -219840 193050
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
The 'poly' function converts the factored form to regular polynomial form, and then we multiply it by the numerator to get the coefficients of the regular polynomial. Please refer to the following documentation for more information on 'poly' function:
Hope this helps!
  3 Comments
Sam Chak
Sam Chak on 26 Aug 2024
I'm a little confused. Are you referring to an inverse function or a reciprocal function? If reciprocal function, then the title of your question is misleading and please consider amending it.
Daniel
Daniel on 26 Aug 2024
Sam,
Darn, I meant reciprocal not inverse. I changed the title. Got these mixed up. Sorry for confusion. I did learn a lot from everyone's answers. Thank you.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!