Question: Need Published Solution Using MATLAB The quadratic formula (http://www.purplemath.com/modules/quadform.htm (Links to an external site.)Links to an external site..) allows us to find the roots of
Need Published Solution Using MATLAB
The quadratic formula (http://www.purplemath.com/modules/quadform.htm (Links to an external site.)Links to an external site..) allows us to find the roots of a quadratic equation of the form,
ax2 + bx + c,
where a, b, and c are constants.
Create a function called quadform( ) that takes as input the coefficients of the quadratic equation (a,b,c) and returns the two distinct real roots (x1,x2) as output, if they exist. In addition, the function returns a message (flag) that informs the user if an error occurred when trying to find two distinct real roots. The possible errors are: (1) "Only one root is found"; (2) "Imaginary roots are found"; (3) "Any value of x is a solution"; (4) "No zeroes exist." If no errors occur, then flag should be "No errors."
a = 1;
b = 2;
c = -1;
[x1,x2,flag] = quadform(a,b,c)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
