In general, polynomials are defined with their coefficients in MatLab®. Sometimes, if you defined a polynomial or if you obtained a polynomial- from another calculation, you need to take its coefficients to obtain Matlab® polynomial to use it in other functions or calculations.
You can do this by using the ‘sym2poly()’ command in Matlab®. Here, we explain how to use the ‘sim2poly()’ command in Matlab® with a very basic example below, which is executed in the Matlab® command window.
How To Use ‘sym2poly()’ Command In MatLab®?
>> syms a y = a^5+2*a^4+a^2+8*a+3; sym2poly(y) ans = 1 2 0 1 8 3 >>
In the example above which is executed in MatLab®, we created a symbolic variable ‘a’ to obtain our polynomial from it with the ‘syms’ command. By using this variable, we obtained our polynomial. And we want to obtain the coefficients of this polynomial.
We simply typed the polynomial inside the ‘sym2poly()’ command then hit the ‘Enter’ key. As an answer, you can see the coefficients of polynomial from left to right order.
So, it is very basic to use the ‘sym2poly()’ command in Matlab® to obtain coefficients of polynomials.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
Do not forget to leave your comments and questions below about the use of the ‘sym2poly()’ command in Matlab® below.
If you want further coding examples about the ‘sym2poly()’ command in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes.
Your precious feedbacks are very important to us.
Leave a Reply