Lab 10 involves Chapter 9 of Gilat-using Numerical Methods to approximate solutions.
DEADLINE NOTE: the assignment is due the following week(Wednesday), with Exam III on
Tuesday. g5c9p313x06 (fzero): Students will use the "fzero" command (pp296-298) to solve an equation. Note that the students should move all terms to one side and plot the resulting function first to determine starting guesses (or intervals) to find solutions. Note the different ways the function can be entered in the fzero command (illustrated on p297 example-I personally prefer defining as an anonymous function-pp231-233. Since they will be plotting, they should use element-by-element operations in the function!). Also, for this problem, students must first define constants K1, K2, a, b, and L0, then define the subfunctions L(x), u(L(x)), FS(u(x)), and finally W(FS(x)) (some or even all of these subfunctions can be combined in the definition if they wish).
g5c9p314x08: Same strategy as above, but simply define the constants Is, q, k, vS, T, and R, then create
I(1st eq) - I(2nd eq) as a function of vD before plotting and using fzero.
g5c9p315x10 (fminbnd): Students will use the "fminbnd" command (pp298-299) to find the minimum and maximum of a function (emphasize bottom of p299 for maxima). Note the different syntax if you want to find the LOCATION of the minimum (x-value) vs the actual minimum (y-value). The function to minimize is S(R1), found by solving V=250 for h and substituting into S (after substituting
R2=2R1). These steps should be done symbolically in MATLAB (refer to pp358-359 for the solve command and pp372-376 for the subs command).
g5c9p319x28 (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. HOWEVER, the quad command does NOT work with vectors
(element-by-element): students have to create the S and C vectors element by element using a loop (for i=1:length(x)). Use the hold on command to plot S(x) vs x and C(x) vs x, then the figure command to create a new window for S(x) vs C(x).
g5c9p319x32 (ode45): the differential equation for exponential growth and decay y' = ky and that the solution to this is y = Ce^(kt). 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 (they 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 ("ODEfun")
3) We will stick with ode45 as the "solver_name"
4) follow the syntax on p305 (plotting example on p307)