Lab 10 - Questions

# Lab 10 - Questions - UNIVERSITY OF CALIFORNIA BERKELEY...

This preview shows pages 1–2. Sign up to view the full content.

UNIVERSITY OF CALIFORNIA, BERKELEY Engineering 7 – Spring 2009 Department of Civil and Environmental Engineering Instructor: Professor Rector 1 Lab 11 [20 pts total] Topics : Root finding, Function Handles Assigned : Monday, 04/20/2009 Due : Monday, 04/27/2009 Type : Take-home Notes on Root Finding Recall that a root of an equation is a value that, when substituted for the independent variable (usually called x ), results in a value of zero for the dependent variable (usually called y ). MATLAB has two library functions ( fzero and roots ) that can be used to solve for the roots of an equation. In this assignment you are asked to plot functions, use a built-in MATLAB root finding function, and write separate functions for two iterative methods for root- finding. Some root finding algorithms require an initial guess (i.e. Newton-Raphson method), while others require the user to ‘bound’ the root with a lower bound and an upper bound (i.e. bisection method). It is generally recommended to plot a function prior to performing any root finding exercises. Plotting the function provides a reasonable initial guess for the root-finding algorithm (and/or appropriate upper and lower bounds). Plotting the function also provides information on the number of roots contained within any given range. 1. MatLab Built-in Functions (3 pts total) In this part, you will use the MATLAB built-in functions fplot to plot functions and fzero to solve equations. Use the help command to find out how these commands work. (a) Plot the following function using MATLAB’s fplot function (or by using MATLAB’s general plot function). Include this plot and the MATLAB code calling the plot function in your report. f(x) = 2*sin(2*x^3)+1.25*x-0.5 (b) Using MATLAB’s fzero , solve the following equation (i.e. find all the roots): f(x) = 2*sin(2*x^3)+1.25*x-0.5 = 0 Include all the MATLAB code used for this question, and the output in your report. IMPORTANT NOTE: The actual numerical results in the examples provided in Question 2 and 3 may or may not be correct. These examples are here only to give an idea of the type and format of the output.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern