Professional Documents
Culture Documents
HW week2
1.
The build-in funcTon clock returns a vector that contains six elements.
clock=(year, month, day, hours, minutes, day)
Store the result from clock in variable called myc, then restore the rst three elements from
myc in a variable called today and last three elements from myc in a variable called now.
Use the x funcTon on now to get just the integer part of the current Tme.
2.
Find the following sum by rst creaTng vectors for the numerators and denominators:
3 5 7 9
+ + +
1 2 3 4
3.
4.
5.
5. A company is calibraTon some measuring instrumentaTon and has measured the radius and
height of one cylinder 10 separate Tmes; they are in vector variables, r and h. Find the volume
from each trial. Also use logical indexing rst to make sure that all measurements were valid
(>0). Create random 10 numbers for following range: 5<r<6, 10<h<11.