% Assignment 1 - getting to know variables and expressions % % Nigel Stepp % % This assignment is meant to get you familiar with writing expressions % in matlab syntax. The best way to learn syntax is to work through % figuring things out. If you are not sure what the right syntax is, % use the matlab help, or if you have trouble finding help there, send me % an email. % % Topics covered: expressions, matlab matirx notation, constants, % variables, structures, vectors of structures. % Question 1: % Write an expression for the area of a 10 cm radius circle % with a 3 cm radius circle cut out of it. Yes, like a doughnut :) % Question 2: % The rotation matrix that will rotate a 2x1 vector by % 90 degrees (counter-clockwise) is the 2x2 matrix: % ( 0 -1 ) % ( 1 0 ) % % Write an expression that will rotate your favorite % 2x1 vector by 90 degrees. % (Note: Applying a rotation matrix to a vector is % the same as multiplying the matrix by the % vector (i.e. matrix * vector).) % Question 3: % Each juggler in a group of jugglers has (among others) the % following properties: % Name % Prefers torches over knives? (this is a boolean type) % Number of objects able to juggle % % Bob prefers torches, and can juggle 5 objects. % Alice does not prefer torches, and can juggle 7 objects. % % 3.1: Create structs for Alice and Bob. Save them as separate % variables. (Please use the same field names for both) % 3.2: Having two separate variables could get a little annoying. % Create a two element vector named 'jugglers' that contains % the preceding information for Alice and Bob. % 3.3: If both Alice and Bob were juggling as many things as possible, % how many objects would they be juggling? % Write an expression to calculate this number using the vector % from 3.2.