Académique Documents
Professionnel Documents
Culture Documents
>> a=5
a=
>> b=11
b=
11
>> (a:b)
ans =
5 6 7 8 9 10 11
3. This command generates a row vector from 5 to 11 with difference of 2 between each value.
>> (a:2:b)
ans =
5 7 9 11
4. This command generates a row vector of points between 10*a and 10*b.
>> logspace(a,b)
ans =
1.0e+11 *
Columns 1 through 12
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000
Columns 13 through 24
0.0000 0.0000 0.0001 0.0001 0.0001 0.0001 0.0002 0.0002 0.0003 0.0004
0.0005 0.0007
Columns 25 through 36
0.0009 0.0012 0.0015 0.0020 0.0027 0.0036 0.0047 0.0063 0.0083 0.0110
0.0146 0.0193
Columns 37 through 48
0.0256 0.0339 0.0450 0.0596 0.0791 0.1048 0.1389 0.1842 0.2442 0.3237
0.4292 0.5690
Columns 49 through 50
0.7543 1.0000
5. This following command generates a row vector of 3 points between decades 10*a and 10*b
>> logspace(a,b,3)
ans =
1.0e+11 *
6. This command generates a row vector of 100 value between 5 and 11 linearly spaced.
>> linspace(a,b)
ans =
Columns 1 through 12
5.0000 5.0606 5.1212 5.1818 5.2424 5.3030 5.3636 5.4242 5.4848 5.5455
5.6061 5.6667
Columns 13 through 24
5.7273 5.7879 5.8485 5.9091 5.9697 6.0303 6.0909 6.1515 6.2121 6.2727
6.3333 6.3939
Columns 25 through 36
6.4545 6.5152 6.5758 6.6364 6.6970 6.7576 6.8182 6.8788 6.9394 7.0000
7.0606 7.1212
Columns 37 through 48
7.1818 7.2424 7.3030 7.3636 7.4242 7.4848 7.5455 7.6061 7.6667 7.7273
7.7879 7.8485
Columns 49 through 60
7.9091 7.9697 8.0303 8.0909 8.1515 8.2121 8.2727 8.3333 8.3939 8.4545
8.5152 8.5758
Columns 61 through 72
8.6364 8.6970 8.7576 8.8182 8.8788 8.9394 9.0000 9.0606 9.1212 9.1818
9.2424 9.3030
Columns 73 through 84
9.3636 9.4242 9.4848 9.5455 9.6061 9.6667 9.7273 9.7879 9.8485 9.9091
9.9697 10.0303
Columns 85 through 96
7. This command generates a row vector of 7 value between 5 and 11 linearly spaced.
>> linspace(a,b,7)
ans =
5 6 7 8 9 10 11
>> a-b
ans =
-6
>> a=5.778
a=
5.7780
>> fix(a)
ans =
>> ceil(a)
ans =
11. 10. This command rounds value toward -ve nearest integer.
>> floor(a)
ans =
>> round(a)
ans =
>> rem(a,b)
ans =
5.7780
14. This command is used to find the remainder of algebraic division and find its modulus.
>> mod(a,b)
ans =
5.7780
>> factorial(b)
ans =
39916800
16. this command is used to find the absolute value of a vector.
>> abs(a)
ans =
5.7780
>> sqrt(b)
ans =
3.3166
>> pi
ans =
3.141592653589793
>> pi
ans =
3.1416
20. This command is used to show the variable name of the program.
>> who
Your variables are:
21. a ans b
a 1x1 8 double
b 1x1 8 double
25. Clear (variable name) command is used to clear the desire variable only.
>> rand
ans =
0.8147
>> rand(2)
ans =
0.1270 0.6324
0.9134 0.0975
>> randn
ans =
-0.4336
30 look for is used to find every place where the variable or command is present.
33. MATLAB has some predefined variable like pi, ans,I and j.
>> i
ans =
0.0000 + 1.0000i