To find the roots of a second order polynomial in MATLAB, you can use the roots
function. The roots
function takes a vector of polynomial coefficients as an input and returns the roots of the polynomial as a column vector.
Here is an example:
main.m126 chars11 lines
In this example, the polynomial is ax^2 + bx + c = 0
, where a = 1
, b = 4
, and c = 3
. The roots
function is called with the vector [a b c]
as an input. The function returns the roots of the polynomial, which are displayed using the disp
function.
gistlibby LogSnag