Sei sulla pagina 1di 2

HW

Record your work by following method:


>>diary(your work name) %your work le name
is created in the current folder
>>diary on %MATLAB starts recording the work
>>diary o %MATLAB stops recording the work
Look for your work le in the set-up folder
(normally the le is in Users>Document>MATLAB)
Print out the text les in font 10 or smaller in two
column (page set up) in order to save the paper!

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.

Find the sum of the rst 10 terms of the harmonic series.


1 1 1 1
1+ + + + +!
2 3 4 5

4.

Find the sum of the rst 50 terms of the geometric series.


1 1 1 1
1+ + + + +!
2 4 8 16

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.

Potrebbero piacerti anche