User Tools

Site Tools


Math 445 Lab #2

Instructions: Use the diary feature to create a diary file to record your Matlab session. Run format compact to save electrons and ultimately trees. Solve the problem set, then turn the diary off. Edit the diary with a text editor to remove mistakes, then print out the diary, write the names of your work group members on it, and turn it in.

Please distribute the work among the group members, and make sure that everyone understand everything!

Problem 1: Attaway edition 1 chapter 1 problems 23, 25, 26, 27, 34, 37.

Attaway 23: Create the following vectors twice, once using linspace and once using the colon operator.

1 2 3 4 5 6 7 8 9 10

2 7 12

Attaway 25: Use the colon and transpose operators to create a column vector that has values -1 to 1 in steps of 0.2.

Attaway 26: Given a vector v of arbitrary length, write an expression that evaluates to the odd-numbered elements of v. Test your expression on vectors v of both even and odd length.

Attaway 27: Given a vector v of arbitrary length, write assignment statements that store the first half of v in a vector v1 and the second half in a vector v2. Make sure your assignment statements work for v of both even and odd length. Hint: use a rounding function such as fix.

Attaway 34: Create a 4 x 2 matrix of all zeros and store it in a variable. Then replace the second row of the matrix with a 3 and a 6.

Attaway 37: Create a 3 x 5 matrix of random real numbers, and then delete the third row.

Problem 2: Use Matlab to solve the problem. Nilanjana has 50 coins worth $9.10. They're all quarters and nickels. How many nickels and how many quarters does she have?

Problem 3: Use Matlab to solve the problem. Flying against the wind, a plane travels 2880 miles in 4.5 hours. Flying with the wind, it travels the same distance in 4 hours. How fast is the wind? How fast is the plane on a windless day?

Problem 4: (bonus) Use Matlab to solve the problem. A man is three times as old as his son was at the time when the father was twice as old as his son will be two years from now. Find the present age of each if their ages now sum to 55.

Problem 5: From Numerical Computing with Matlab by Clive Moler.

gibson/teaching/fall-2012/math445/lab2.txt · Last modified: 2012/09/04 06:58 by gibson