Lab C covers Chapters 4 and 5 of the MATLAB...

advertisement
Lab C covers Chapters 4 and 5 of the MATLAB textbook.
Chapter 4 of the MATLAB book focuses on formatting output in MATLAB.
#8: No formatting required in this problem. Use a formula to find k and calculate A (assuming A0=1).
#21 (fprintf): DO NOT WORRY ABOUT INPUTTING THE POINTS! Script files with user input do
not publish. Instead, just define the coordinates (x1, y1, x2, etc) in the script file. NOTE that the first
matrix is a 2x2 matrix, NOT (x1-x2)*(y1-y2) and so on! Remember that you solved a system of
equations last lab (#34). Once you solve for Cx and Cy, use the fprintf command (pp104-107) to create
the desired mix of text and output.
#25: (fprintf) To begin, obtain the first equation (by hand) from the first column of data, and note that
is is a linear equation in a0, a1, a2, a3, and a4. Once you obtain the 5x5 coefficient matrix, solve as in
the previous problem.
=======================================================
Chapter 5 of the MATLAB book uses element-by-element operations on vectors to produce plots)
with a little twist: you will fill in some of their enclosed regions! To start, read the material in the
link "Supplement 7" on the MATLAB schedule page go over the chapter 5 problems first as they
explain the basic plot commands used in Supplement 7).
#3: (plotting functions and labels): The method for plotting functions is on pp139-140 of GILAT.
Students will use element-by-element operations to create a graph. All graphs must include a title and
axis labels (Gilat p144).
#7: (plotting functions, hold on, labels, and legends): Same instructions as above, but this graph
should include a legend (p145). NOTE: The derivative does NOT need to be done in MATLAB,
although you can do so if you want. ALSO NOTE: The hold on command is discussed on pp142-143.
#14 (plotting functions, fill): Similar to the first example, but x and y are both functions of t. Plot the
parametrized curve in this problem and follow the steps in Supplement 7, problem 3 to fill with the
appropriate color (NOTE: there are no points to plot in this one, so
you don't use ALL the commands in the example!)
#17 (plotting functions, fill): Plot the upper and lower halves of the ellipse (NOTE: You can
alternatively parametrize the ellipse). Fill as done in Example 2 or 3 of the Supplement with the
appropriate color.
Problem 4 Supplement 7: Use symbolic differentiation to find the equation of the normal line, use
solve to find the intersections (see code for Example 2 or GILAT chapter 11 for review), fill to shade
the area (and plot the corner points with filled circles as done in the first two
supplement problems), and int to calculate the area. (NOTE: to fill, first plot x^2 from 0 to 2, then the
normal line from 2 to the intercept, THEN define x=[int:-0.1:0] and y=0*x: or define x as usual and use
the fliplr command mentioned in the Summary).
Download