Equation behind solution by using function roots
Show older comments
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.
Accepted Answer
More Answers (1)
Walter Roberson
on 11 Jul 2016
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.)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!