Professional Documents
Culture Documents
L01 Codigo
L01 Codigo
a=[1 2 3];
b=[4;5;6];
a*c
{Undefined function or variable 'c'.
}
c=b
c=
4
5
6
a*c
ans =
32
dot(a,c)
ans =
32
A=c*a
A=
12
10
15
12
18
a*a
{Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('mtimes
')" style="font-weight:bold"> * </a>
Inner matrix dimensions must agree.
}
a.*a
ans =
a.^2
ans =
exp(a)
ans =
2.7183
7.3891 20.0855
log(a)
ans =
0.6931
1.0986
exp(a)
ans =
2.7183
7.3891 20.0855
log(ans)
ans =
sqrt(a)
ans =
1.0000
1.4142
1.7321
format long
sqrt(a)
ans =
format
2^(-24)
ans =
5.9605e-08
sum(b), mean(c)
ans =
15
ans =
b=a.^2
b=
sum(b), mean(c)
ans =
14
ans =
pi
ans =
3.1416
y=tan(pi/6)
y=
0.5774
B=
-3
-1
-7
-1
x=B\c
x=
-1.2995
1.3779
-0.1014
norm(B*x-c)/norm(B)*norm(x)
ans =
3.4722e-16
norm(B*x-c)/(norm(B)*norm(x))
ans =
9.6513e-17
e=eig(B)
e=
-3.1361 + 0.0000i
6.5680 + 5.1045i
6.5680 - 5.1045i
[V,D]=eig(B)
V=
D=
[H,I]=round(eig(B))
{Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('round')
" style="font-weight:bold">round</a>
Too many output arguments.
}
round(V)
ans =
round(D)
ans =
v=1:6
v=
w=2:3:10
w=
y=1:-0.25:0
y=
1.0000
0.7500
C=[A,[8;9;10]]
C=
10
15
12
18
10
C, D=[B;a]
12
0.5000
0.2500
C=
12
10
15
12
18
10
D=
-3
-1
-7
-1
C(2,3)
ans =
15
C(2:3,1:2)
ans =
10
12
I3 =
Y=
Z=
diary of