EGR_102_Lab_10A_HW-1

EGR_102_Lab_10A_HW-1 - initial supplied interval, an error...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
EGR 102 Introduction to Engineering Modeling Lab 10A Homework Given the equation: (±) ² ³´µ¶± · ¸ ´µ¹º± ¸ ºµ» Write a MATLAB function to determine the roots of the given equation using the Bisection method. The function is to take the initial guess for the range, x l and x u , as inputs and should output the value of the root located within this range. Use a while loop to keep iterating until the size of the interval is small (that is, until | x u x l | < 0.001 ). Refer to Lecture Notes for solved examples of the Bisection method. The MATLAB function should only output the final root, but should also display the values of x l , x u , and x r every iteration using MATLAB’s disp() function. Use MATLAB Help to determine how to use the disp() function effectively. Additionally, before the program begins iterating, the function should check that the interval supplied by the user is valid. If the equation does not cross the x-axis within the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: initial supplied interval, an error message should be returned. Finally, test your function by finding the two roots of the equation. Hint: One root is positive, and one root is negative. It is strongly recommended that you create a flowchart for this problem before you begin writing MATLAB code. Additionally, remember that you may use the debugging mode to check that the MATLAB code is working correctly. Copy your Command Window results and your M-file into a Word document and submit it to the Lab HW 10A drop box. Place your name and lab section number on the document. Title both your Word document and your submission to the drop box as follows: (lab section #)_(last name)_(first name)_HW10A For example: 1_Smith_John_HW10A (do not put zeros in the lab section #) Due Date: Before Lab 10B begins....
View Full Document

Ask a homework question - tutors are online