Quadprog applies only to the solver-based approach. X zeros 21. Roots1 -3 2 and Matlab will give you the roots of the polynomial equation.
Solve an Equation If eqn is an equation solve eqn x solves eqn for the symbolic variable x.
For example solve x 1 2 x solves the equation x 1 2 for x. S solve eqnvar solves the equation eqn for the variable var. The following example solves the quadratic equation x 2 -7x 12 0. If we want to compute the roots of the following expression.