SUNY Geneseo Department of Mathematics
Monday, May 1
Math 230 02
Spring 2017
Prof. Doug Baldwin
See sample exam in “Final Materials” folder under “Files” in Canvas.
My solutions are also there.
drawCar
function
(from drawCar.m) that students did not have to write.Monday, May 8, 8:00 AM, in our regular classroom.
Comprehensive, but emphasizing material since the second hour exam (e.g., vectorization, strings, cell arrays, etc.).
Designed for around 1 1/2 hours, you’ll have 2 1/2.
There may be one closed-book question, but the rest will be open-references and open-computer (but closed-person) as in the past.
Rules and format otherwise similar to hour exams, especially open-references rule.
I’ll bring donuts and cider.
Extended hours during finals: open at 9:30 each morning from May 3 through May 10, plus 1:00 - 3:30 and 7:30 - 9:30 Sunday.
7 responses, nearly 1/3 of the class, as of this morning. Thank you!
Matlab has built-in types for things like numbers, matrices, cell arrays, strings, etc. But most large programs involve things that conceptually are not any of the built-in Matlab types. For example, there is no “mad lib” or “Eliza dialog” type, yet you are working with programs that deal with those things. “Representation” is about figuring out how to use Matlab types to capture the more abstract things a program “really” works on.
Recall the mad lib program and instructions and fairy tale mad libs from Friday.
How does that program represent a mad lib?
Load either or both mad libs into Matlab. Try playing one of the mad libs with play2
.
It won’t work, because two lines are missing (marked by comments in place of actual code).
Fill in the two missing lines.
The repaired code could look like this:
...
if isCue
% Input a string from the user and assign it to variable “current,”
% using element s of the Mad Lib as a prompt.
current = input( madlib{s}, 's' );
else
% Assign element s of the Mad Lib to variable “current.”
current = madlib{s};
end
...
Create your own mad lib and verify that it works with play2
.
Note that you can double-click on a variable in the workspace window to open it in an editor that lets you view and change its content. Changing contents may require using Matlab syntax though, e.g., enclosing strings in quotation marks.
(No Next Lecture)