Question: Please complete in MATLAB: 4. Write a MATLAB function to solve the quadratic equation ar? +bx+c= 0, using the classical quadratic formula 2+ = (-6762

Please complete in MATLAB:

Please complete in MATLAB: 4. Write a MATLAB function to solve the

4. Write a MATLAB function to solve the quadratic equation ar? +bx+c= 0, using the classical quadratic formula 2+ = (-6762 - 4ac)/(2a). (a) Test your function on the following cases: (i) a = 2, b=3, c=1, (ii) a = 1, b = 3, c = 4. In each case and for each choice of sign, verify the accuracy of the numerical solution by comparing it with the exact solution. (b) Now consider the case (iii) a = 1, b = 3, c= 8-14 One solution is l_ ~-3. Test your MATLAB script on case (iii). It should perform poorly, so modify it to obtain accurate approximate roots. Finally, use MATLAB to make a table which displays three sets of roots for case (iii), those calculated with your original function, your modified function, and MATLAB's internal roots function. 4. Write a MATLAB function to solve the quadratic equation ar? +bx+c= 0, using the classical quadratic formula 2+ = (-6762 - 4ac)/(2a). (a) Test your function on the following cases: (i) a = 2, b=3, c=1, (ii) a = 1, b = 3, c = 4. In each case and for each choice of sign, verify the accuracy of the numerical solution by comparing it with the exact solution. (b) Now consider the case (iii) a = 1, b = 3, c= 8-14 One solution is l_ ~-3. Test your MATLAB script on case (iii). It should perform poorly, so modify it to obtain accurate approximate roots. Finally, use MATLAB to make a table which displays three sets of roots for case (iii), those calculated with your original function, your modified function, and MATLAB's internal roots function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!