load prom1
save prom2 a b c
clear
load prom2
load prom1
save promtxt a A b f -ascii
clear
load prom1 a b c d
1==2
ans =
0
2~=3
ans =
1
whos
Name Size Bytes Class Attributes
a 1x1 8 double
ans 1x1 1 logical
b 1x1 8 double
c 1x1 8 double
d 1x1 8 double
2>3/5
ans =
1
0.4<=sin(pi/6)
ans =
1
sin(pi/6)
ans =
0.5000
2=3
2=3
|
{Error: The expression to the left of the equals sign
is not a valid target for an assignment.
}
a==3
ans =
0
a=3
a =
3
1&2
ans =
1
1&0
ans =
0
1&&0
ans =
0
0&&1
ans =
0
1|0
ans =
1
0|0
ans =
0
1||0
ans =
1
1&~0
ans =
1
1+...
6
ans =
7
5+6...
5+6...
|
{Error: Unexpected MATLAB operator.
}
5+6 ...
+9-7
ans =
13
5+6-...
5
ans =
6
% gsd;lgk ;dlgk
% b=5
% B=5
M=8 % fghlk hkgh ;lk
M =
8
%{
tyty=4
popop=8
ytyty=8
%}
i
ans =
0.0000 + 1.0000i
j
ans =
0.0000 + 1.0000i
pi
ans =
3.1416
eps
ans =
2.2204e-16
pi=8
pi =
8
clear pi
pi
ans =
3.1416
sin=7
sin =
7
clear sin
sin=7
sin =
7
sin(3)
{Index exceeds matrix dimensions.
}
clear sin
5/0
ans =
Inf
ans-ans
ans =
NaN
0/0
ans =
NaN
sind(30)
ans =
0.5000
sin(pi/6)
ans =
0.5000
whos
Name Size Bytes Class Attributes
M 1x1 8 double
a 1x1 8 double
ans 1x1 8 double
b 1x1 8 double
c 1x1 8 double
d 1x1 8 double
v=1 2 3
v=1 2 3
|
{Error: Unexpected MATLAB expression.
}
v=[1 2 3]
v =
1 2 3
v1=[5 6 7]
v1 =
5 6 7
www=7;
v1=[5 6 7];
5-7;
v3=[5/9 2^3 sin(4) pi/3 10]
v3 =
0.5556 8.0000 -0.7568 1.0472 10.0000
v4=[-5 v 7*9]
v4 =
-5 1 2 3 63
v4=[-5 v 7*9]
v4 =
-5 1 2 3 63
v5=[a/5 b^a -4]
v5 =
0.6000 8.0000 -4.0000
whos
Name Size Bytes Class Attributes
M 1x1 8 double
a 1x1 8 double
ans 1x1 8 double
b 1x1 8 double
c 1x1 8 double
d 1x1 8 double
v 1x3 24 double
v1 1x3 24 double
v3 1x5 40 double
v4 1x5 40 double
v5 1x3 24 double
www 1x1 8 double
v6=[1,5,6 5]
v6 =
1 5 6 5
v6=[1 ,5, 6 5]
v6 =
1 5 6 5
v6=[1 , ,5, 6 5]
v6=[1 , ,5, 6 5]
|
{Error: Expression or statement is
incorrect--possibly unbalanced (, {, or [.
}
M=[4 5 6;3 2 1]
M =
4 5 6
3 2 1
M1=[9 8 7
1 2 3
4 5 6]
M1 =
9 8 7
1 2 3
4 5 6
M2=[9*7 pi eps/123654 ; 6 5 4]
M2 =
63.0000 3.1416 0.0000
6.0000 5.0000 4.0000
M3=[v;9 8 7]
M3 =
1 2 3
9 8 7
M3=[v;9 8 7 5]
{Error using vertcat
Dimensions of matrices being concatenated are not
consistent.
}
SL=[10;20;30]
SL =
10
20
30
SL1=[40 50 60]'
SL1 =
40
50
60
M
M =
4 5 6
3 2 1
MT=M'
MT =
4 3
5 2
6 1
O=ones(3)
O =
1 1 1
1 1 1
1 1 1
O=ones(3,4)
O =
1 1 1 1
1 1 1 1
1 1 1 1
Z=zeros(3)
Z =
0 0 0
0 0 0
0 0 0
Z=zeros(3,6)
Z =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
J=eye(3)
J =
1 0 0
0 1 0
0 0 1
J=eye(3,5)
J =
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
R=rand
R =
0.8147
R1=rand(3)
R1 =
0.9058 0.6324 0.5469
0.1270 0.0975 0.9575
0.9134 0.2785 0.9649
hist(rand(1000))
RN=randn(3)
RN =
1.6980 -0.3804 0.6040
-0.2218 -1.5310 1.8377
0.5371 0.8381 -1.1413
RN=randn(3,5)
RN =
-0.8036 -1.2499 0.0127 -0.0941 -0.1052
-0.1538 -0.1644 -0.1505 1.4089 2.6825
0.2493 -0.3521 1.3819 -0.2367 -1.5305
hist(randn(1000))
randi
{Error using randi
Not enough input arguments.
}
randi(3)
ans =
3
randi([1 3])
ans =
1
randi([1 3])
ans =
3
randi([1 3])
ans =
1
randi(10)
ans =
6
randi([9 10])
ans =
10
randi([9 10])
ans =
10
randi([9 10])
ans =
9
randi(20, 3)
ans =
7 19 11
20 17 13
12 7 9
randi(20,[4 3])
ans =
14 11 19
13 12 9
16 6 8
9 12 1
randi([5 20],[4 3])
ans =
10 14 11
17 17 17
5 10 17
18 8 8
RI=randi([5 20],[4 3]);
whos
Name Size Bytes Class Attributes
J 3x5 120 double
M 2x3 48 double
M1 3x3 72 double
M2 2x3 48 double
M3 2x3 48 double
MT 3x2 48 double
O 3x4 96 double
R 1x1 8 double
R1 3x3 72 double
RI 4x3 96 double
RN 3x5 120 double
SL 3x1 24 double
SL1 3x1 24 double
Z 3x6 144 double
a 1x1 8 double
ans 4x3 96 double
b 1x1 8 double
c 1x1 8 double
d 1x1 8 double
v 1x3 24 double
v1 1x3 24 double
v3 1x5 40 double
v4 1x5 40 double
v5 1x3 24 double
v6 1x4 32 double
www 1x1 8 double
M4=randi(100,6)
M4 =
30 74 56 31 95 63
28 70 26 13 38 17
20 65 66 31 87 59
38 33 65 50 19 99
23 42 6 58 33 29
37 55 34 42 93 35
TR=tril(M4)
TR =
30 0 0 0 0 0
28 70 0 0 0 0
20 65 66 0 0 0
38 33 65 50 0 0
23 42 6 58 33 0
37 55 34 42 93 35
TR1=triu(M4)
TR1 =
30 74 56 31 95 63
0 70 26 13 38 17
0 0 66 31 87 59
0 0 0 50 19 99
0 0 0 0 33 29
0 0 0 0 0 35
LIN=linspace(1,10,30)
LIN =
Columns 1 through 5
1.0000 1.3103 1.6207 1.9310 2.2414
Columns 6 through 10
2.5517 2.8621 3.1724 3.4828 3.7931
Columns 11 through 15
4.1034 4.4138 4.7241 5.0345 5.3448
Columns 16 through 20
5.6552 5.9655 6.2759 6.5862 6.8966
Columns 21 through 25
7.2069 7.5172 7.8276 8.1379 8.4483
Columns 26 through 30
8.7586 9.0690 9.3793 9.6897 10.0000
plot(linspace(1,10,30))
logspace(1,2,10)
ans =
Columns 1 through 5
10.0000 12.9155 16.6810 21.5443 27.8256
Columns 6 through 10
35.9381 46.4159 59.9484 77.4264 100.0000
LIN=logspace(1,5,200)
LIN =
1.0e+05 *
Columns 1 through 5
0.0001 0.0001 0.0001 0.0001 0.0001
Columns 6 through 10
0.0001 0.0001 0.0001 0.0001 0.0002
...
Columns 191 through 195
0.6593 0.6906 0.7233 0.7575 0.7934
Columns 196 through 200
0.8310 0.8704 0.9116 0.9548 1.0000
plot(logspace(1,5,200))
1:5
ans =
1 2 3 4 5
2:4
ans =
2 3 4
1:0.5:3
ans =
1.0000 1.5000 2.0000 2.5000 3.0000
1:0.7:3
ans =
1.0000 1.7000 2.4000
M5=[1:3;4:6]
M5 =
1 2 3
4 5 6
[2:4]
ans =
2 3 4
5:4
ans =
Empty matrix: 1-by-0
P=5:4
P =
Empty matrix: 1-by-0
P+1
ans =
Empty matrix: 1-by-0
PPP+1
{Undefined function or variable 'PPP'.
}
5:-1:1
ans =
5 4 3 2 1
9/3:2^2:100
ans =
Columns 1 through 8
3 7 11 15 19 23 27 31
Columns 9 through 16
35 39 43 47 51 55 59 63
Columns 17 through 24
67 71 75 79 83 87 91 95
Column 25
99
save promhodne
diary off