How can I find the trivial solution to a polynomial equation?
1 回表示 (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2021 年 9 月 24 日
回答済み: MathWorks Support Team
2021 年 9 月 24 日
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
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Linear Algebra についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!