Equation behind solution by using function roots
显示 更早的评论
Here is a minimum working example of my code:
f = [1 0 3 2];
V = roots(f);
It gives me the roots:
0.298035818991661 + 1.80733949445202i
0.298035818991661 - 1.80733949445202i
-0.596071637983321 + 0.00000000000000i
Here is the general solution to this equation:

How can I find out that matlab uses which of these equations for all of the three solutions?
In short: I want to find out not only the solution but also the equation used by Matlab to reach that solution. I know, I could manually input these values in the general solution and find the answer. But that will be cumbersome for many such equations. So I will require a compact solution.
采纳的回答
更多回答(1 个)
Walter Roberson
2016-7-11
Please see http://www.mathworks.com/help/matlab/ref/roots.html#buo5imt-5 which describes the algorithm. It usually works numerically, not by equation. However, you can use
syms x1 x2 x3 x4
roots([x1 x2 x3 x4])
to see the generalized equation (which might not be used in some circumstances that would result in degeneracies.)
类别
在 帮助中心 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!