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.
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.
Walter, that poly2sym command was very helpful! I didn't know you could take an array of numbers and apply them to create a polynomial. My problem is solved! Thank you.
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.
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:
When I divide the numerator by the denominator, I get an error using the "/" symbol: Matrix dimensions must agree. How would I get rid of the denominator? I was thinking if I could take the inverse of it, I could bring that up into the numerator section.
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.
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.