Lab 10 - Questions


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

View Full Document Right Arrow Icon
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. 2. Bisection Method of Root Finding (5 pts total) The bisection method is an iterative algorithm for finding the roots of an equation. In this method, the user supplies two values ( x1 and x2 ) that bracket the root. Write a MATLAB function that finds the root(s) of an equation using the bisection method. This function should
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4


This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online