You are on page 1of 2

GROUP 19-MAT LAB ASSIGNMENT Nsiah-Nimo Michael-5103910 Antwi Boasiako Collins-5097710 Anokye Madeleine-5097510 Hayfron Paul-5102310 Wilmer Effah-5101310

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

You might also like