Professional Documents
Culture Documents
Clase02 Vectores Matlab
Clase02 Vectores Matlab
0.5000
0.6000
0.7000
0.8000
>> d=linspace(1,5,6)
d =
1.0000
1.8000
2.6000
3.4000
>> x
x =
3
1
7
5
>> x(1:3)
ans =
3
1
7
>> x(1:2:3)
ans =
3
7
>> x(4:-1:1)
ans =
5
7
1
3
>> x(4:-2:1)
ans =
5
1
>> x
x =
3
1
7
5
>> y=x(2:3)
y =
1
7
>> x
x =
3
1
7
5
>> b=[x(2:3) x(1) x(2) x(4)+10]
b =
1
7
3
1
15
>> b(8)
??? Index exceeds matrix dimensions.
>> b(8)=9
b =
1
7
3
>> b(2)=[]
b =
1
3
1
>> b(1:2:7)=[]
b =
3
15
0
>> n=length(b)
n =
3
>> length(x)
ans =
4
>> whos
Name
Size
a
1x1
ans
1x1
b
1x3
d
1x6
f
1x6
n
1x1
x
1x4
15
15
Bytes
8
8
24
48
48
8
32
Class
double
double
double
double
double
double
double
0.9000
1.0000
4.2000
5.0000
Attributes
y
z
1x2
1x3
16
24
double
double
>> f
f =
0.5000
0.6000
>> f(1:2:length(f))
ans =
0.5000
0.7000
>> f(1:2:end)
ans =
0.5000
0.7000
>> x
x =
3
1
7
>> x>2
ans =
1
0
1
0.7000
0.9000
0.9000
5
1
0.8000
0.9000
1.0000