Professional Documents
Culture Documents
Comandos de Matlab
Comandos de Matlab
ans =
'20-Sep-2019'
clc
a=15
a =
15
b=7;
a+b
ans =
22
a-b
ans =
a*b
ans =
105
a/b
ans =
2.1429
a^b
ans =
170859375
who
a ans b
whos
Name Size Bytes Class Attributes
a 1x1 8 double
ans 1x1 8 double
b 1x1 8 double
clc
format long
pi
ans =
3.141592653589793
format short
pi
ans =
3.1416
format short e
pi
ans =
3.1416e+00
format long e
pi
ans =
3.141592653589793e+00
ans =
3.1416e+000
ans =
3.14159265358979e+000
format bank
pi
ans =
3.14
formaat hex
{ Undefined function or variable 'formaat'.
}
format hex
pi
ans =
400921fb54442d18
format rat
pi
ans =
355/113
format +
pi
ans =
-pi
ans =
ans =
format short
inf
ans =
Inf
NAN
{ Undefined function or variable 'NAN'.
}
nan
ans =
NaN
real min
ans =
realmin
ans =
2.2251e-308
max
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('max
')" style="font-weight:bold">max</a>
Not enough input arguments.
}
realmax
ans =
1.7977e+308
ceil(pi
ceil(pi
ans =
fix
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('fix
')" style="font-weight:bold">fix</a>
Not enough input arguments.
}
fix
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('fix
')" style="font-weight:bold">fix</a>
Not enough input arguments.
}
fix(pi)
ans =
flor(pi)
{ Undefined function or variable 'flor'.
}
floor(pi)
ans =
round(pi)
ans =
abs(-pi)
ans =
3.1416
sign(pi)
ans =
sign(-pi
sign(-pi
ans =
-1
sign(0)
ans =
pxp(0)
{ Undefined function or variable 'pxp'.
}
exp(0)
ans =
exp(2)
ans =
7.3891
gcd(9.12)
{ Not enough input arguments.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('gcd
', 'E:\toolbox\matlab\specfun\gcd.m', 25)" style="font-
weight:bold">gcd</a> (<a href="matlab:
opentoline('E:\toolbox\matlab\specfun\gcd.m',25,0)">line 25</a>)
if ~isequal(size(a),size(b)) && ~isscalar(a) && ~isscalar(b)
}
gcd(9,12)
ans =
gcd(12,2)
ans =
lcm(12,2)
ans =
12
lcm(9,12)
ans =
36
log(10)
ans =
2.3026
log2(10)
ans =
3.3219
log10(10)
ans =
mod(-12,5)
ans =
rem(12,5)
ans =
2
sqrt(50)
ans =
7.0711
nthroot(50,3)
ans =
3.6840
x=3+5i
x =
3.0000 + 5.0000i
whos
Name Size Bytes Class Attributes
a 1x1 8 double
ans 1x1 8 double
b 1x1 8 double
x 1x1 16 double complex
y=2-4j
y =
2.0000 - 4.0000i
abs(x)
ans =
5.8310
real(x)
ans =
imag(x)
ans =
conj(x)
ans =
3.0000 - 5.0000i
complex(5,-4)
ans =
5.0000 - 4.0000i
sign(x)
ans =
0.5145 + 0.8575i
angle(x)
ans =
1.0304
isreal(x)
ans =
whos
Name Size Bytes Class Attributes
a 1x1 8 double
ans 1x1 1 logical
b 1x1 8 double
x 1x1 16 double complex
y 1x1 16 double complex
x(2)
{ Index exceeds matrix dimensions.
}
x=[3,4 -5,2 8,8]
x =
3 4 -5 2 8 8
x=(|1 3 5])
x=(|1 3 5])
A =
1 2 3
4 5 6
7 8 9
A(2;2:3)
A(2;2:3)
ans =
5 6
A(2,[3 1])
ans =
6 4
A(end,[1 3])
ans =
7 9
(1:7)
ans =
1 2 3 4 5 6 7
(1:10:10)
ans =
(1:3:10)
ans =
1 4 7 10
zeros(5)
ans =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
one(5)
{ Undefined function or variable 'one'.
}
ones(5)
ans =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
ones(5,3)
ans =
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
column 6
{ Undefined function or variable 'column'.
}
Column 6
{ Undefined function or variable 'Column'.
}
rand
ans =
0.8147
rand(6)
ans =
rand(5,2)
ans =
0.3171 0.7655
0.9502 0.7952
0.0344 0.1869
0.4387 0.4898
0.3816 0.4456
randn(5)
ans =
ans =
-0.1924 0.4882
0.8886 -0.1774
-0.7648 -0.1961
-1.4023 1.4193
-1.4224 0.2916
eye(4)
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
eye(4,3)
ans =
1 0 0
0 1 0
0 0 1
0 0 0
hilb(5)
ans =
hilb(5)
ans =
invhilb(5)
ans =
A =
1 2 3
4 5 6
7 8 9
B=A+5
B =
6 7 8
9 10 11
12 13 14
A+B
ans =
7 9 11
13 15 17
19 21 23
A-B
ans =
-5 -5 -5
-5 -5 -5
-5 -5 -5
A*B
ans =
60 66 72
141 156 171
222 246 270
A.*B
ans =
6 14 24
36 50 66
84 104 126
A =
1 2 3
4 5 6
7 8 9
B
B =
6 7 8
9 10 11
12 13 14
A/B
[ Warning: Matrix is singular to working precision.]
ans =
C=A.^2
C =
1 4 9
16 25 36
49 64 81
A/C
ans =
A./c
{ Undefined function or variable 'c'.
}
A./C
ans =
A\C
[ Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =
2.202823e-18.]
ans =
1.0e+17 *
A^2
ans =
30 36 42
66 81 96
102 126 150
A.^2
ans =
1 4 9
16 25 36
49 64 81
A'
ans =
1 4 7
2 5 8
3 6 9
A.'
ans =
1 4 7
2 5 8
3 6 9
A =
1 2 3
4 5 6
7 8 9
cond(A(
cond(A(
ans =
5.0523e+16
det(A)
ans =
-9.5162e-16
diad(X)
{ Undefined function or variable 'X'.
}
diag(x)
ans =
3 0 0 0 0 0
0 4 0 0 0 0
0 0 -5 0 0 0
0 0 0 2 0 0
0 0 0 0 8 0
0 0 0 0 0 8
diag(A)
ans =
1
5
9
A =
1 2 3
4 5 6
7 8 9
eig(A)
ans =
16.1168
-1.1168
-0.0000
inv(A)
[ Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND =
2.202823e-18.]
ans =
1.0e+16 *
lnegth(A)
{ Undefined function or variable 'lnegth'.
}
length(A)
ans =
3
norm(A)
ans =
16.8481
norm(A,3)
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('nor
m')" style="font-weight:bold">norm</a>
The only matrix norms available are 1, 2, inf, and 'fro'.
}
norm(A,1)
ans =
18
norm(A,inf)
ans =
24
norm(A,fro)
{ Undefined function or variable 'fro'.
}
norm(A,'fro')
ans =
16.8819
norm(A)
ans =
16.8481
hel`p
hel`p
<a
href="matlab:matlab.internal.language.introspective.overloads.displayOver
loads('norm')">Other functions named norm</a>
normest(A)
ans =
16.8481
nunl(A)
{ Undefined function or variable 'nunl'.
}
null(A)
ans =
-0.4082
0.8165
-0.4082
orth(A)
ans =
-0.2148 0.8872
-0.5206 0.2496
-0.8263 -0.3879
pinv(A)
ans =
poly(A)
ans =
ans =
size(A)
ans =
3 3
trace
{ Not enough input arguments.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('tra
ce', 'E:\toolbox\matlab\matfun\trace.m', 11)" style="font-
weight:bold">trace</a> (<a href="matlab:
opentoline('E:\toolbox\matlab\matfun\trace.m',11,0)">line 11</a>)
if ~ismatrix(A) || size(A,1)~=size(A,2)
}
trace(A)
ans =
15
A =
1 2 3
4 5 6
7 8 9
tril(A)
ans =
1 0 0
4 5 0
7 8 9
triu(A)
ans =
1 2 3
0 5 6
0 0 9
cross(x,y)
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('cro
ss', 'E:\toolbox\matlab\specfun\cross.m', 25)" style="font-
weight:bold">cross</a> (<a href="matlab:
opentoline('E:\toolbox\matlab\specfun\cross.m',25,0)">line 25</a>)
A and B must be of length 3 in the dimension in which the cross product
is taken.
}
dot(x,y)
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('dot
', 'E:\toolbox\matlab\specfun\dot.m', 33)" style="font-
weight:bold">dot</a> (<a href="matlab:
opentoline('E:\toolbox\matlab\specfun\dot.m',33,0)">line 33</a>)
A and B must be same size.
}
Y
{ Undefined function or variable 'Y'.
}
y = [3 4 5]
y =
3 4 5
dot(x,y)
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('dot
', 'E:\toolbox\matlab\specfun\dot.m', 33)" style="font-
weight:bold">dot</a> (<a href="matlab:
opentoline('E:\toolbox\matlab\specfun\dot.m',33,0)">line 33</a>)
A and B must be same size.
}
clc
diary off