Escolar Documentos
Profissional Documentos
Cultura Documentos
Metodos Numericos
Metodos Numericos
ans =
'29-Mar-2019'
clc
a=5
a =
b=7
b =
b=7;
a+5
ans =
10
a-b
ans =
-2
a*b
ans =
35
a/b
ans =
0.7143
a^b
ans =
78125
who
a ans b
whos
Name Size Bytes Class Attributes
a 1x1 8 double
ans 1x1 8 double
b 1x1 8 double
pi
ans =
3.1416
format long
pi
ans =
3.141592653589793
format short
pi
ans =
3.1416
format short
format short e
pi
ans =
3.1416e+00
format long e
pi
ans =
3.141592653589793e+00
format short g
pi
ans =
3.1416
format long g
pi
ans =
3.14159265358979
ans =
3.1416e+000
ans =
3.14159265358979e+000
format bank
pi
ans =
3.14
format hex
pi
ans =
400921fb54442d18
format rat
pi
ans =
355/113
format mas
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('for
mat')" style="font-weight:bold">format</a>
Unrecognized command option mas.
}
format +
pi
ans =
-pi
ans =
ans =
clc
format shor
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('for
mat')" style="font-weight:bold">format</a>
Unrecognized command option shor.
}
format short
inf
ans =
Inf
30/0
ans =
Inf
nan
ans =
NaN
5+3j
ans =
5.0000 + 3.0000i
5+3i
ans =
5.0000 + 3.0000i
whos
Name Size Bytes Class Attributes
a 1x1 8 double
ans 1x1 16 double complex
b 1x1 8 double
clc
realmin
ans =
2.2251e-308
realmax
ans =
1.7977e+308
clock
ans =
1.0e+03 *
clc
ceil
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('cei
l')" style="font-weight:bold">ceil</a>
Not enough input arguments.
}
ceil(pi)
ans =
fix(pi)
ans =
3
floor(pi)
ans =
round(pi)
ans =
clc
sin(pi)
ans =
1.2246e-16
sind(180)
ans =
cos(pi)
ans =
-1
tan(pi)
ans =
-1.2246e-16
tand(pi)
ans =
0.0549
tand(180)
ans =
csc(pi)
ans =
8.1656e+15
cot(pi)
ans =
-8.1656e+15
sec(pi)
ans =
-1
secd(pi)
ans =
1.0015
tanh(pi)
ans =
0.9963
asin(1)
ans =
1.5708
acosh(1)
ans =
abs(-15)
ans =
15
sign(ans)
ans =
sign(-14)
ans =
-1
sign(0)
ans =
exp(1)
ans =
2.7183
exp
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('exp
')" style="font-weight:bold">exp</a>
Not enough input arguments.
}
gcd(9.12)
{ Not enough input arguments.
Error in <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('gcd
', 'C:\Program Files\MATLAB\R2017b\toolbox\matlab\specfun\gcd.m', 25)"
style="font-weight:bold">gcd</a> (<a href="matlab: opentoline('C:\Program
Files\MATLAB\R2017b\toolbox\matlab\specfun\gcd.m',25,0)">line 25</a>)
if ~isequal(size(a),size(b)) && ~isscalar(a) && ~isscalar(b)
}
gcd(9,12)
ans =
lcm(9,12)
ans =
36
log(10)
ans =
2.3026
log2(10)
ans =
3.3219
log10(10)
ans =
mod(-12.7)
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('mod
')" style="font-weight:bold">mod</a>
Not enough input arguments.
}
mod(-12,7)
ans =
mod(12,7)
ans =
mod(-12,5)
ans =
mod(12,5)
ans =
help mod
<strong>mod</strong> Modulus after division.
<strong>mod</strong>(x,y) returns x - floor(x./y).*y if y ~= 0,
carefully computed to
avoid rounding error. If y is not an integer and the quotient x./y is
within roundoff error of an integer, then n is that integer. The
inputs
x and y must be real and have compatible sizes. In the simplest
cases,
they can be the same size or one can be a scalar. Two inputs have
compatible sizes if, for every dimension, the dimension sizes of the
inputs are either the same or one of them is 1.
The statement "x and y are congruent mod m" means mod(x,m) ==
mod(y,m).
By convention:
<strong>mod</strong>(x,0) is x.
<strong>mod</strong>(x,x) is 0.
<strong>mod</strong>(x,y), for x~=y and y~=0, has the same sign as
y.
Note: REM(x,y), for x~=y and y~=0, has the same sign as x.
<strong>mod</strong>(x,y) and REM(x,y) are equal if x and y have the
same sign, but
differ by y if x and y have different signs.
rem(12,5)
ans =
rem(-12,5)
ans =
-2
sqrt(100)
ans =
10
nthroot(27,3)
ans =
nthroot(27,5)
ans =
1.9332
clc
x=3+4j
x =
3.0000 + 4.0000i
y=3
y =
z=5
z =
x =
3.0000 + 4.0000i
abs(x)
ans =
angle(x)
ans =
0.9273
angled(x)
{ Undefined function or variable 'angled'.
}
angle(x)
ans =
0.9273
complex(3,7)
ans =
3.0000 + 7.0000i
complex(3,-7)
ans =
3.0000 - 7.0000i
conj(ans)
ans =
3.0000 + 7.0000i
imag(x)
ans =
x =
3.0000 + 4.0000i
real(x)
ans =
sign(x)
ans =
0.6000 + 0.8000i
isreal(x)
ans =
isreal(y)
ans =
x=[1,7,-3 4 6]
x =
1 7 -3 4 6
y=x+2
y =
3 9 -1 6 8
z=x+y
z =
4 16 -4 10 14
x =
1 7 -3 4 6
x(2)
ans =
x(end)
ans =
x =
1 7 -3 4 6
x(1:2:5)
ans =
1 -3 6
x =
1 7 -3 4 6
x([3 5 4])
ans =
-3 6 4
x =
1 7 -3 4 6
x(2:4)
ans =
7 -3 4
A=[1 2 3;4 5 6]
A =
1 2 3
4 5 6
A(2,1)
ans =
A =
1 2 3
4 5 6
A(2)
ans =
A(2,:)
ans =
4 5 6
A(:,2)
ans =
2
5
A(2,2:3)
ans =
5 6
A(2,[¨3 1])
A(2,[¨3 1])
ans =
6 4
A([2 1],2:3)
ans =
5 6
2 3
A(end,[1 3])
ans =
4 6
A =
1 2 3
4 5 6
zeros(3)
ans =
0 0 0
0 0 0
0 0 0
zeros(3,2)
ans =
0 0
0 0
0 0
ones(3)
ans =
1 1 1
1 1 1
1 1 1
ones(3,2)
ans =
1 1
1 1
1 1
rand(5)
ans =
rand(3,2)
ans =
0.7577 0.6555
0.7431 0.1712
0.3922 0.7060
randn(4)
ans =
randn(3,2)
ans =
0.6277 -0.8637
1.0933 0.0774
1.1093 -1.2141
eye(5)
ans =
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
eye(5,3)
ans =
1 0 0
0 1 0
0 0 1
0 0 0
0 0 0
hilb(4)
ans =
invhilb(4)
ans =
A =
1 2 3
4 5 6
B=A+1
B =
2 3 4
5 6 7
A+B
ans =
3 5 7
9 11 13
A-B
ans =
-1 -1 -1
-1 -1 -1
A*B
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('mti
mes')" style="font-weight:bold"> * </a>
Inner matrix dimensions must agree.
}
A*.B
A*.B
ans =
2 6 12
20 30 42
A*B'
ans =
20 38
47 92
A =
1 2 3
4 5 6
A'
ans =
1 4
2 5
3 6
A.'
ans =
1 4
2 5
3 6
A/B
ans =
1.3333 -0.3333
0.3333 0.6667
A./B
ans =
A.\B
ans =
A\B
ans =
A^2
{ Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('mpo
wer')" style="font-weight:bold"> ^ </a>
One argument must be a square matrix and the other must be a scalar. Use
POWER (.^) for elementwise power.
}
A.^2
ans =
1 4 9
16 25 36
x=[1 2 3]
x =
1 2 3
y=x+2
y =
3 4 5
cross(x,y)
ans =
-2 4 -2
dot(x,y)
ans =
26
A =
1 2 3
4 5 6
7 8 9
cond(A)
ans =
5.0523e+16
det(A)
ans =
-9.5162e-16
diag(x)
ans =
1 0 0
0 2 0
0 0 3
diag(A)
ans =
1
5
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 *
length(B)
ans =
norm(A)
ans =
16.8481
norm(A,n)
{ Undefined function or variable 'n'.
}
help norm
<strong>norm</strong> Matrix or vector norm.
<strong>norm</strong>(X,2) returns the 2-norm of X.
norm(A,'fro')
ans =
16.8819
norm(A,2)
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)
ans =
16.8481
null(A)
ans =
-0.4082
0.8165
-0.4082
A
A =
1 2 3
4 5 6
7 8 9
orth(A)
ans =
-0.2148 0.8872
-0.5206 0.2496
-0.8263 -0.3879
pinv(A)
ans =
pinv(B)
ans =
-1.1111 0.6111
-0.1111 0.1111
0.8889 -0.3889
poly(A)
ans =
rank(A)
ans =
size(A)
ans =
3 3
trace(A)
ans =
15
tril(A)
ans =
1 0 0
4 5 0
7 8 9
tril(B)
ans =
2 0 0
5 6 0
triu(A)
ans =
1 2 3
0 5 6
0 0 9
diary off