 channelflow.org

Site Tools

gibson:teaching:fall-2014:math445:lab1

Math 445 Lab #1

These problems are taken from Attaway chapter 1, both 2nd and 3rd editions. Remember, Matlab's help function is your friend.

Problem 1: Evaluate these expressions in your head and write down the answer. Then evaluate them with Matlab. If you made a mistake, figure out what it was.

25/4*4

3+4^2

4\12 + 4

3^2

(5-2)*3

Problem 2: What is the type (class) of the answers in problem 1?

Problem 3: Use intmin and intmax to determine the range of values that can be stored in the types uint32 and uint64. Express the answers as integers and in scientific notation.

Problem 4: Wind chill factor: The WCF conveys how cold it feels with a given air temperature T (degrees Farenheit) and wind speed V (miles per hour). A formula for WCF is Create variables for temperature T and wind speed V and then using this formula, calculate the WCF for (a) T = 45 F and V = 10 mph and (b) T = 45 F and V = 0 mph.

(Does the Wind Chill Factor make sense to you? Why or why not?)

Problem 5: Use Matlab help to understand the following questions, and then answer them based on your understanding. Then use Matlab to check your answers. Rethink any questions you answered incorrectly.

is fix(3.5) == floor(3.5)?

is fix(3.4) == fix(-3.4)?

is fix(3.2) == floor(3.2)?

is fix(-3.2) == floor(-3.2)?

is fix(-3.2) == ceil(-3.2)?

What is the type of fix(-3.2) == ceil(-3.2)?

Problem 6: Find Matlab expressions for

cube root of 19

3 to the 1.2

tangent of pi

Evaluate the expressions. Do you notice anything unexpected? Can you explain it?

Problem 7: Generate random numbers

real in range 0-1

real in range 0-20

real in range 20-50

integer in range 0-10

integer in range 0-11

integer in range 50-100

Problem 8: Get into new Command window and type rand to get a random real number. Make a note of the number. Then exit and restart matlab, and repeat. The random number should be the same. Exit and restart matlab again. This time, change the random number seed before generating a new random number. The random number should be different this time.

Problem 9: Evaluate these expressions in your head, and then check your answers by evaluating them with Matlab. If you made any mistakes, figure out why.

'b' >= 'c' + 1

3 == 2 + 1

(3 == 2) + 1

xor(5 < 6, 8 > 4)

What is the type (class) of each of the answers?

Problem 10: The geometric mean g of n numbers is given by This is useful, for example, in finding the average rate of return on an investment with varying yearly return. If an investment returns 15% its first year, 5% its second, and 10% its third, the average rate of return is Compute the average rate of return, expressed as a percent.

gibson/teaching/fall-2014/math445/lab1.txt · Last modified: 2014/09/01 18:56 by gibson

Page Tools 