Professional Documents
Culture Documents
GROUP 19.m
GROUP 19.m
a = input ( 'input coef of x^2:'); b = input ('input coef of x:'); c = input ('input constant term:'); discriminant= b^ 2 - 4* a*c ; if discriminant < 0 disp ('complex roots') else disp('real roots') x1 = (-b + (sqrt(b^2 - 4*a*c)))/2*a x2 = (-b - (sqrt(b^2 - 4*a*c)))/2*a x = -9:9; y =a*x.^2 + b.*x + c; plot (x,y); end input coef of x^2:1 input coef of x: 1 input constant term:-6 real roots
x1 =2
x2 = -3