In general, you obtain the polynomials in Matlab® functions or command with their coefficients. Generally, these coefficients are given in the form of a vector. You can obtain the actual polynomial by using a symbolic variable.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
To do it, you need to use the ‘poly2sym()’ command in Matlab®. Here, we explain how to use the ‘poly2sym()’ command in Matlab® with a very basic example that is executed in the Matlab® command window.
How To Use ‘poly2sym()’ Command In MatLab®?
>> syms a y = [2 6 34 6 3 6 3 0 0 6 3]; poly2sym(y,a) ans = 2*a^10 + 6*a^9 + 34*a^8 + 6*a^7 + 3*a^6 + 6*a^5 + 3*a^4 + 6*a + 3 >>
First of all, we created a symbolic variable ‘a’. This symbolic variable will be used for obtaining the full polynomial. After this, we defined our polynomial with its coefficients in the ‘y’ matrix. This matrix can be created from other functions that are available in Matlab®.
We typed this matrix inside the ‘poly2sym()’ command and we typed the symbolic variable ‘a’ respectively.
Look at the answer and see the obtained polynomial with coefficients.
So you can use this command to obtain your polynomials in Matlab® only by writing the coefficients inside a matrix.
Do not forget to leave your comments and questions below about the use of the ‘poly2sym()’ command in Matlab® below.
If you want further coding examples about the ‘poly2sym()’ command in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes.
Leave a Reply