SUNY Geneseo Department of Mathematics
Friday, October 9
Math 230 01
Fall 2015
Prof. Doug Baldwin
myArray( row, column )
>> m1 = [ 1 2 3; 10 20 30 ]
m1 =
1 2 3
10 20 30
>> m1'
ans =
1 10
2 20
3 30
>> m1(6)
ans =
30
>> m1(2,3)
ans =
30
>> m1(3)
ans =
2
>> m1(2) = 100
m1 =
1 2 3
100 20 30
>> zeros( 4 )
ans =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
>> zeros( 2, 4 )
ans =
0 0 0 0
0 0 0 0
>> eye( 3 )
ans =
1 0 0
0 1 0
0 0 1
>> rand( 3, 5 )
ans =
0.9706 0.8003 0.9157 0.6557 0.9340
0.9572 0.1419 0.7922 0.0357 0.6787
0.4854 0.4218 0.9595 0.8491 0.7577
>> rand( 3 )
ans =
0.7431 0.1712 0.2769
0.3922 0.7060 0.0462
0.6555 0.0318 0.0971
>> rand( 1, 10 )
ans =
Columns 1 through 6
0.8235 0.6948 0.3171 0.9502 0.0344 0.4387
Columns 7 through 10
0.3816 0.7655 0.7952 0.1869
stickPerson
function>> v = 1 : 7
v =
1 2 3 4 5 6 7
>> v( 2: 4 )
ans =
2 3 4
>> m1
m1 =
1 2 3
100 20 30
>> m1( 1, 1:2 )
ans =
1 2
>> m1
m1 =
1 2 3
100 20 30
>> m1( 1, : )
ans =
1 2 3
>> m1 = [ 2 4 6; 7 8 9 ]
m1 =
2 4 6
7 8 9
>> m2 = [ 10 20; 30 40; 3 5 ]
m2 =
10 20
30 40
3 5
>> m1 * m2
ans =
158 230
337 505
>> m3 = eye(2)
m3 =
1 0
0 1
>> m2
m2 =
10 20
30 40
3 5
>> m3 * m2
{Error using *
Inner matrix dimensions must agree.}
>> stickPerson
>> drawFigure( tilt ) % drawFigure and tilt are parts of my solution