Question: this is the problem and the code i have so far. its displayinv what is supposed to be the roots but theyre both always equal.
this is the problem and the code i have so far. its displayinv what is supposed to be the roots but theyre both always equal. im not sure what i did wrong 
ZOOM + . For a given quadratic equation (ax?+bx+c=0). We know that there are two possible roots. The roots may be: real, real but equal, and complex. XP-4x + 4 = 0 has real equal roots : x=2 and x=2 x2 - 4x + 7 = 0 has complex roots: x=2+i1.732 and x=2-i1.732 xl-5-x - 14 = 0 has real roots x= 7 and x=2 We determine the root type for a given quadratic formula by look at the discriminant, where discriminant =b2-4ac . If discriminant 0, then the roots are non-equal and real Write an m-file that uses fprintf to print description of the problem for user, and then asks a user for the coefficients a, b, and c from a quadratic equation. Then, use conditional statements to determine the discriminant and decide the type of roots. Calculate the roots, but don't use Matlab function roots. Use fprintf statements to tell the user the root type and then tell the user what the roots are. cm -.m c.m .m fprintf('using the problem ax^2+bx+c#we are able to find the roots and the rationality of the roots. please above statment is the description that the user is given a=input(' a: '); initializing input variable for a from the user b=input('b'); initializing input variable for b from the user c=input('c='); initializing input variable for c from the user M Processing d={{b^2)-4*a*c); calculating the value of d, the discriminent, using inputs from the users C.m C... 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 - 26 27 28 29 30 C.m C... C.m EC... EC.m 4 Result Output if de statenent that says that if the discriminate are less than zero they are complex x1=-b+sqrt(d)/(2-a);Aboth of these are the equations for finding roots, one is negative and one is positi *2=-b-sqrt(d)/(2*a); fprintt'the roots are complex and are f and M1 ',x1,x2) statenent telling the user that the roots are elselt du fprintf("the roots are equal and real and are equal to ostatment that says that if the discriminate e else do X1 (-besqrt(d))/(2a): x2=(-b-sqrt(d))/(2a): fprintf('the roots are not equal but are real and are f and f,x1,x2)statement that says that if the EC... EC.m EC... .m 4.m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
