How can I find the trivial solution to a polynomial equation?

조회 수: 1 (최근 30일)
Given is a polynomial of the folllowing form,
pol = c11 + c12*x + c13*x^2 + c14*x^3 - (c21 + c22*x + c23*x^2 + c34*x^3)
How can I have MATLAB find the trivial roots 'c11 = c21', 'c12 = c22', 'c13 = c23' and 'c14 = c34' by means of the Symbolic Math Toolbox?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 9월 24일
Firstly, function 'coeffs' has to be used in order to factorize the latter expression with respect to the unknown variable 'x', namely,
 
syms c11 c12 c13 c14 c21 c22 c23 c34 x
pol = c11 + c12*x + c13*x^2 + c14*x^3 - (c21 + c22*x + c23*x^2 + c34*x^3);
pol_c = coeffs(pol,x)
See the following documentation page for more information accordingly,
This will return a vector of the corresponding factors of the latter polynomial expression with respect to 'x' that has the size of the number of powers of 'x' in the expression, from 0 up to the highest power. Thus, in this case one would obtain a vector 'pol_c' with four symbolic factors, namely,
>> pol_c
pol_c =
[c11 - c21, c12 - c22, c13 - c23, c14 - c34]
Then, please consider using function 'solve' for the symbolic equation that results if you set the latter vector equal to a vector of zeros, namely,
 sol = solve(pol_c == zeros(1, length(pol_c)));
In this way, 'sol' is a struct that contains as field names the names of the unknown variables and as fields the corresponding solution for each of the aforementioned equations. For instance,
>> sol.c11
ans =
c21

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by