Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Write a MATLAB function to solve the quadratic equation ar? +bx+c= 0, using the classical quadratic formula x = (-6 + 762 - 4ac)/(2a).

image text in transcribed

4. Write a MATLAB function to solve the quadratic equation ar? +bx+c= 0, using the classical quadratic formula x = (-6 + 762 - 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 2-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 x = (-6 + 762 - 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 2-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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago