I am struggling with my project which requires me to produce a function which solves a quadratic equation. It requires 2 outputs [discriminant, quadRoots]. The roots must also be in row vectors. my function produces the roots but does not show the discriminant,please may someone have a look at my code. Thanks Tom
function [disc, quadRoots] = Q1_15024248(a,b,c) disc = b^2-4*a*c; x1 = -b + sqrt(disc)/2*a; x2 = -b - sqrt(disc)/2*a; quadRoots = [x1,x2]; end
Best Answer