MATLAB: Write a matlab command to find th roots of: ax^2+bx+c=0

ax^2+bx+c=0homeworkMATLAB

write a MATLAB commads to find the roots of : ax^2+bx+c=0 , where a,b and c are constants?

Best Answer

a=1;
b=2;
c=3;
x1 = -b +(sqrt((b^2)-(4ac)/(2a))x;
x2=-b-(sqrt((b^2)-(4ac)/(2a));
disp(x1);
disp(x2);