Lab 8 covers Chapter 8 of Gilat (polynomials and curve-fitting).

advertisement
Lab 8 covers Chapter 8 of Gilat (polynomials and curve-fitting).
g5c8p286x02 (polyval): Strategy is outlined in the problem. Define your polynomial as
a vector, then use the polyval command, all explained on pp262-263 of Gilat.
g5c8p288x12 (polyder, roots, and polyval): do part (a) by hand, then define the
polynomial in MATLAB. Use polyval to plot (part (b)). For part (c), use roots to solve
the equation (remembering to change the constant to -1000). In part (d), note that, for
a polynomial, the derivative is 0 at the maximum. Therefore, you should use polyder to
get the derivative (pp266-267), roots to find the critical value(s) (pp263-264), and
polyval to find the one with the largest y-value (pp262-263). Note that the polyval
command works on vectors as well (so all y-values can be found at once). Students
should also pay attention ONLY to roots that are in the physical domain of the problem
(0<= x <= 11).
g5c8p289x19 (polyfit, polyval): Refer to pp267-270 for an explanation of what the
polyfit command does. After using the polyval command to plot the equation (as in
g5c8p286x02), hold on, then plot the data using the plot command (pp148-149).
g5c8p290x21 (polyfit, polyval): Same as the previous question, only with a exponential
function instead. Refer to pp271 and 272, and especially the example at the bottom of
273-274 (IGRORE the semilog and loglog plots in the middle of 273; just start with the
code), and use the polynomial (polyval) to estimate the value at 4.5 hours, then plot
the equation and data as before.
g5c8p290x28c (interp1): Interpolation is explained on pp274-277. Define your data,
then create a plottable vector (xi in the example on p277, though I like to call my data
xdata/ydata and use x and y for plotting), and use the "interp1" (ends with the number
one) to create the y vector. Since there are two graphs, use the "figure" command to
separate the plots (do NOT plot them on the same graph!).
Download