MATLAB: I have a matrix which is 2×1 that contains the roots of a quadratic polynomial. How to assign a variable to only take the positive root

indexindexingmatrix manipulationquadraticroots

I have this code, shown below, to obtain the roots of a quadratic equation. How do I assign the variable alpha_1 to always take the positive root calculated in root_Fit.
root_Fit = roots(p_FiT)
alpha_1 = root_Fit(2)

Best Answer

alpha_1 = root_Fit(root_Fit>0)