Documente Academic
Documente Profesional
Documente Cultură
LABORATORIO DE MATLAB
1)
>> X=[1 2 3 3 4 6 8]
X=
1 2 3 3 4 6 8
>> a=X(1,6)
a=
>> rem(X,-2)==0
ans =
0 1 0 0 1 1 1
>> sum(ans)
ans =
4
>> mean(X)
ans =
3.8571
>> sum(X>ans)
ans =
>> X(6)=999
X=
1 2 3 3 4 999 8
>> X(1)=33
X=
33 2 3 3 4 999 8
>> X(5:2:7)=33
X=
33 2 3 3 33 999 33
>> X(1)=33
X=
33 2 3 3 4 6 8
>> X(5:2:7)=33
X=
33 2 3 3 33 6 33
Z=
3 3 8
>> Y=X(end,1-1)
Y=
8 6 4 3 3 2 1
>> min(X)
ans =
>> mean(X-min(X))
ans =
2.8571
>> mean(X)-min(X)
ans =
2.8571
>> C^=[X(2:1:7)]
??? C^=[X(2:1:7)]
|
Error: The expression to the left of the equals sign is not a valid target for an assignment.
>> C=[X(2:1:7)]
C=
2 3 3 4 6 8
>> mean(C)
ans =
4.3333
>> D=[X(3:1:7)]
D=
3 3 4 6 8
>> mean(D)
ans =
4.8000
>> X=[1 2 3 3 4 6 8];
>> E=[X(1:2:7)]
E=
1 3 4 8
>> Y=E
Y=
1 3 4 8
>> sum(rem(X,3)==0)
ans =
E=
1 3 3
>> sum(rem(E,3)==0)
ans =
>> rem(X,3)
ans =
1 2 0 0 1 0 2
>> rem(X,3)==0
ans =
0 0 1 1 0 1 0
>> cont(ans9
??? cont(ans9
>> cont(ans)
ans =
0 0 1
>> rem(X,3)==3
ans =
0 0 0 0 0 0 0
>> rem(X,3)==0
ans =
0 0 1 1 0 1 0
>> ans
ans =
0 0 1 1 0 1 0
>> X(ans)
ans =
3 3 6
>> sum(ans)
ans =
12
>> Y=X(:,7)=[]
??? Y=X(:,7)=[]
Error: The expression to the left of the equals sign is not a valid target for an assignment.
>> X(:,7)=[]
X=
1 2 3 3 4 6
>> Y=X
Y=
1 2 3 3 4 6
>> length(X)
ans =
7
>> R=[a:b)]
??? R=[a:b)]
>> (a:b)
ans =
>> a=1
a=
>> b=1
b=
>> R=[(a:b)]
R=
>> b=5
b=
>> R=[(a:b)]
R=
1 2 3 4 5
>> c=2
c=
>> b010
>> b=10
b=
10
>> Q=[(a:c:b)]
Q=
1 3 5 7 9
>> linspace(a:b:c)
n = double(n);
>> a=1
a=
>> b=3
b=
3
>> c=15
c=
15
>> linspace(a:b:c)
n = double(n);
>> linspace(a,b,c)
ans =
Columns 1 through 10
1.0000 1.1429 1.2857 1.4286 1.5714 1.7143 1.8571 2.0000 2.1429 2.2857
Columns 11 through 15
>> linspace(a,b,c)
ans =
Columns 1 through 7
Columns 8 through 14
Column 15
>> linspace(a,b,100)
ans =
Columns 1 through 6
Columns 7 through 12
Columns 19 through 24
Columns 25 through 30
Columns 31 through 36
Columns 37 through 42
Columns 43 through 48
Columns 49 through 54
Columns 61 through 66
Columns 67 through 72
Columns 73 through 78
Columns 79 through 84
Columns 85 through 90
Columns 91 through 96
31/11 281/99 283/99 95/33 287/99 289/99
>> logspace(a,b,c)
ans =
Columns 1 through 6
Columns 7 through 12
Columns 13 through 15
>> logspace(a,b,50)
ans =
Columns 1 through 6
10 1505/137 3198/265 13045/984 1835/126 11327/708
Columns 7 through 12
Columns 13 through 18
Columns 19 through 24
Columns 25 through 30
Columns 31 through 36
Columns 37 through 42
Columns 49 through 50
51887/57 1000
>> B=[0:2:20]
B=
Columns 1 through 6
0 2 4 6 8 10
Columns 7 through 11
12 14 16 18 20
>> B.^2
ans =
Columns 1 through 6
0 4 16 36 64 100
Columns 7 through 11
>>