Question: 1 . Sketch a flowchart and write a MATLAB function to solve Exercise 4 . 6 of your MATLAB textbook. [ Hint: see MATLAB Control

1. Sketch a flowchart and write a MATLAB function to solve Exercise 4.6 of your MATLAB textbook. [Hint: see MATLAB Control Structures Part II lecture]. Add a copy/picture of your flowchart here.
Exercise 4.6
A function takes three numeric arguments representing the coefficients of a quadratic equation and returns two values, which are the two roots of the equation. The name of the function is quadRoots.
1. Write a suitable prototype or definition for the function. Add an appropriate help and usage section at the top of the function, and save it in a suitably named file.
2. Add a test to check if the quadratic roots are complex and to return
with an error if this is true (see Section 4.3, doc error or help error).
3. Complete the function quadRoots and test that it gives the correct results.
4. Modify the quadRoots function so that it accepts a single array containing all three coefficients and returns a single array containing the roots.

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 Programming Questions!