Students will work on Matlab Assignment 7, which covers chapter... reminding you that what a function is! (a rule that...

advertisement
Students will work on Matlab Assignment 7, which covers chapter 7 of Gilat (functions). Begin by
reminding you that what a function is! (a rule that assigns a unique output to each input). Note that
"inputs" and "outputs" can be several variables (think of it as a single vector whose components
correspond to each variable).
g5c7p248x02: (anonymous functions) pp231-233 of Gilat. Students define the function in their M-file
using the @ notation. Go over the example on p233
(especially noting the element-by-element definition needed when plotting). NOTE that all plots
MUST have titles and axes labels (see Gilat p144, with formatting details on pp145-148. Also refer to
pp156-157 for polar plots).
For the remaining problems, students are to create separate function files using the "function"
command. Refer to pp223-229, paying particular attention to the example file near the top of p229
which is used (in their M-file) midway through the page. Also emphasize that the name of the function
file must agree with the name given on the first line (in this example, "loan.m")-Matlab defaults to this
name, so don't change it! If you want, they can click on "New" then "Function" under the home tab
and Matlab will give the default format (they just need to replace everything with the appropriate
names and variables)
g5c7p249x04: Obviously neither you nor me will know how to convert
kg/m^3 to lbs/in^3 off the top of their head, so you can search for the appropriate conversion. If you
complain, note that's how you do it in industry! Otherwise, the above paragraph is all that's needed for
this problem.
g5c7p251x12: This is not a direct calculation, so students should begin by
listing the steps (subtract A-B and C-B to get vectors, then use the dot product formula). NOTE that
you calculated the angle between vectors in Lab 3 (g5c3p090x20) and that the method explained in #19
does NOT depend on the components (meaning they can use it for 2-d OR 3-d vectors!)
g5c7p252x20: Since this function has no output, it should start with
"function NAME(INPUT)". It is easiest to plot the circle using parametrized equations (discuss with
each other what those equations would look like based on your inputs).
g5c7p253x21: Students can refer to Section 13.4 in the Stewart text for the formulas to convert Polar
Coordinates to Cartesian, but you can review from 151 (and PHYS 218) that this is what is done when
given (for example) a Force vector with given magnitude at a given angle.
In addition, you should work on the appropriate Maplet for recitation.
Download