SPRING 2016 MATH 151 LAB C HINTS 1. Chapter #4

advertisement
SPRING 2016 MATH 151 LAB C HINTS
DUE: MARCH 25, 2016
1. Chapter #4
Chapter 4 of Gilat focuses on formatting output in Matlab.
• Chapter 4 #2: (disp): Define the variables (N is a vector), and calculate P using
element-by-element operations. Once P is calculated, display the table (N, P ) using
the disp command (example on pp102 − 103).
• Chapter 4 #4: Similar strategy to #2 except that now the table has four columns:
r1, r2, V , and S. Using the example on pp102 − 103, just add two more columns
before displaying (for example, table(:, 3) = V 0 ; )
• Chapter 4 #5: No formatting is specified, but use a two-column table (x, T ).
• Chapter 4 #13: (max, f printf ): The hardest part here is setting up the equations
for b and Area (welcome to the world of engineering!) Once you determine the
equations, you will NOT have to use calculus to find the maximum; you should
follow the steps outlined at the end of the problem. (NOTE: refer to p76 for
help on the max command; in particular knowing WHERE the max occurs). You
should use the f printf command (pp103 − 107) to display a sentence stating the
dimensions with the largest printed area.
• Chapter 4 #25: Write the given function and show how to get the equation obtained
from the first point. Once the system of equations is obtained, solve the system
like you did in Ch 3 #35. NOTE: You should NOT display your answer using a
sentence with f printf !
2. Chapter #5
Chapter 5 of Gilat uses element-by-element operations on vectors to produce plots.
• Chapter 5 #5 (f plot, plot labels): Use the f plot function (pp140 − 141) to plot
the function, then title the graph and label the axes (p144). This last step is
required for ALL plots as discussed in #6 of the “MATLAB Procedures” document:
http://calclab.math.tamu.edu/MATLAB/MATLAB Procedures.html.
• Chapter 5 #10 (plotting functions, hold on, axis): The method for plotting functions is on pp139 − 140 of Gilat. Use element-by-element operations to create a
graph (*VERY IMPORTANT). In this particular example, you define the vector t,
then define x, y, u, and v in terms of t. Plot (x, y), then use the hold on command
1
2
DUE: MARCH 25, 2016
(pp142 − 143) to plot (u, v) on the same graph. Finally, use the axis command
(p148) to set the x and y axis range on the graph.
• Chapter 5 #11 (holdon, axis): Follow the directions outlined in the problem to
plot the function without vertical lines, then use the axis command to set the x
and y range.
• Chapter 5 #27: Use a strategy similar to #11 to plot the piecewise function. Use
a δx small enough (relative to the range) to get a smooth graph: a δx of 0.1 is fine
for an x-range of, say, 0 to 20, but NOT for this example!
• Chapter 5 #35 (subplot): Rather than plotting all three functions on the same
graph and using a legend, plot the 3 graphs in a 3x1 grid using the subplot command
(p157, example on p162).
Download