Question: In MATLAB: Write a program that determines the roots of a quadratic equation ax 2 +bx+c=0 When the program runs, it should ask the user
In MATLAB:
Write a program that determines the roots of a quadratic equation ax2+bx+c=0 When the program runs, it should ask the user for the number of cases they want to calculate. Then it should use that number to set the for loop in the code. The constants a, b and c have to entered by the user. Then use the discriminant D
D=b2 - 4ac
If D>0, the program displays a message The equation has two roots: and the roots are ####, ####
If D = 0, the program displays a message The equation has one root and it is #####
If D<0, the program displays a message The equation has no real roots
NOTE: D is the discriminant not the roots of the equation, you have to find the roots.
Run your script using the following three equations: a. 2x2+8x+8=0
b. -5x2+3x-4=0
c. -2x2+7x+4=0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
