SUNY Geneseo Department of Mathematics
Monday, January 26
Math 230 02
Spring 2015
Prof. Doug Baldwin
>> randi( 1, 100 )
ans =
… many lines of 1s …
>> help randi
… description of how to use randi …
>> randi( [1,100], 1 )
ans =
16
>> randi( [1,100], 1 )
ans =
97
>> rand
ans =
0.8763
>> rand * 100
ans =
48.8629
>> floor( rand * 100 )
ans =
40
>> round( rand*100 )
ans =
13
>> ceiling( rand*100 )
{Undefined function 'ceiling' for input arguments of type 'double'.}
>> ceil( rand*100 )
ans =
1
>> randi( [1,100] )
ans =
19
>> randi( [1,100], 5 )
ans =
33 34 27 29 8
6 24 84 27 6
15 46 70 26 26
73 19 34 68 44
49 33 59 52 29
>> pi + 1
ans =
4.1416
>> format long
>> pi + 1
ans =
4.141592653589793
>> 1 + inf
ans =
Inf
>> 1e9 + 1
ans =
1.000000001000000e+09
>> 1e100 + 1
ans =
1.000000000000000e+100
>> 3 + 5 * 9
ans =
48
>> (3+5) * 9
ans =
72
>> % This is a comment
>> x = pi / 4
x =
0.785398163397448
>> 1 / √(1-x^2)
1 /√(1-x^2)
|
{Error: The input character is not valid in MATLAB statements or expressions.}
>> 1 / sqrt(1-x^2)
ans =
1.615532655169348