SPRING 2016 MATH 151 LAB E HINTS DUE: MAY 3, 2016 Note: May 3rd is redefined as Friday by the University, which gives you about 2 weeks to complete the homework. Please plan accordingly to avoid delays. 1. Chapter #8 Chapter 8 of Gilat covers polynomials and curve-fitting. • Chapter 8 #11 (polyval, polyder, roots): First set up the polynomial by hand. Once you have the polynomial, define it as a vector, use polyval to plot (pp262 − 263), then use polyder (pp266 − 267) and roots (pp263 − 264) to find the critical values (using the graph to determine which is the maximum) • Chapter 8 #12 Same as #11, but for part c), also use roots on p(x) − 1000 (can be entered by hand or subtracted in MATLAB) to solve. • Chapter 8 #23(a) (polyfit, polyval): Refer to pp267 − 270 for an explanation of what the polyfit command does. After using the polyval command to plot the equation (#2), hold on, then plot the data using the plot command (pp148-149). • Chapter 8 #25 (polyfit, polyval): Here you have to decide which type of function to use. See pp271 − 273 for further explanation to what is stated in the problem. The logarithmic plots can be reviewed in Chapter 5 (pp149 − 150). Once you decide which plot to use, same strategy as above, using a first-degree polynomial as explained on p272. • Chapter 8 #26 Here you are creating a function to fit a power function (p272) to given data as explained in the problem. After using the function, use polyval to plot the function and plot the data as in the previous two problems. 2. Chapter #9 Chapter 9 of Gilat uses Numerical Methods to approximate solutions. • Chapter 9 #4 (fzero): Use the fzero command (pp296 − 298) to solve an equation. Note that you should plot the function first to determine starting guesses (or intervals) to find solutions. • Chapter 9 #12 (fminbnd): Use the fminbnd command (pp298 − 299) to find the minimum or maximum of a function (see bottom of p299 for maxima). Note the 1 2 DUE: MAY 3, 2016 different syntax if you want to find the LOCATION of the minimum (x-value) vs the actual minimum (y-value). As with fzero, you should plot the function first to determine an appropriate interval containing the max and min. • Chapter 9 #27 (quad): Experienced MATLAB users will recall that the help for the quad command states that it is being phased out. It has been saying this for 3 years now, so we will stick with the text (pp300 − 302) and use it. • Chapter 9 #32 (ode45): Recall that the differential equation for exponential growth and decay is y 0 = ky and that the solution to this is y = Cekt . Differential equations are extremely practical in engineering, and most cannot be solved explicitly-the best that can be done is to numerically approximate the solutions (you will learn how this works in MATH 308). The steps for doing so in MATLAB are on pp303 − 307 and summarized here: (1) make sure the problem is in the form dy/dx = f (x, y), (2) define a function (function file or anonymous) for f , (3) we will stick with ode45 as the solver name, (4) follow the syntax on p305 (plotting example on p307). • Chapter 9 #39 Same process as #32.