FIC MATLAB 2018-2/Aula-2

De MediaWiki do Campus São José
Ir para: navegação, pesquisa
%-- 13-09-2018 19:24:36 --%
% Vetores
format compact
editor
edit
a = 1
b = 2;
vet1 = [1 2 3 4 5 6]
whos vet1
vet2 = [7, 8, 9, 10]
vet2 = [7,8,9,10]
vet2 = [7,8,9,                               10]
vet3 = [17; 11; 45; 13; 30; 99]
whos vet3
vet4 = [1 + 3]
vet4 = [1 +3]
nomequevocesquiserem = vet3
uiimport
% Matrizes
mat1 = [1 2 3 4; 5 6 7 99]
mat1 = [1, 2, 3, 4; 5, 6, 7, 99]
mat2 = [1 3 5 8 8
-1 -4 -7 -9
mat2 = [1 3 5 8 8
-1 -4 -7 -9 -9
10 11 0 1 3.5]
mat1 = [1, 2, 3, 4; 5, 6, 7, a]
mat1 = [1, 2, 3, 4; 5, 6, 7, 'a']
matx = [1 2 3 4; 10 20 30]
length(vet1)
length(vet3)
length(mat1)
length(mat2)
doc length
size(mat1)
size(mat2)
size(mat2,1)
size(mat2,2)
size(mat2,3)
size(mat2,4)
size(mat2,5)
size(mat2)
size(size(mat2))
size(size(size(mat2)))
% Arranjos de vetores
vet1 = [1 2 3 4 5 6]
vet5 = 1:6
vet5 = [1:6]
vet6 = 1:0.5:6
vet7 = 1:2:6
vet8 = 1:15:10
vet8 = 1:3+8:10
vet8 = 1:1+2:10
vet8 = 1:1 + 2:10
vet8 = 1:(1+2):a
vet9 = 1:-1:5
size(vet9)
vet9 = 10:2:5
vet9 = 10:-2:5
vet7 = 1:2:6
vet7 = 1:0.0004:6
vet7 = 1:7/3
vet7 = 1:1/3:7/3
vet7 = 1:Inf
vet7 = 1:900000000000:Inf
vet7 = 1:Inf:Inf
vet7 = Inf:Inf:Inf
vet7 = Inf:NaN:Inf
vet7 = 1:0:10
vet9 = 1:(6-1)/10:6
vet9 = 1:(6-1)/9:6
% Linspace
linspace(4,8,10)
0.5673:5e-3:0.569
0.5673:5e-3:0.59
% Logspace
logspace(2, 3, 5)
format bank
logspace(2, 3, 5)
177.83 / 100
316.23 / 177.83
format
pi
format long
pi
format bank
pi
format short
format compact
% Matrizes especiais
eye(3)
eye(10)
eye(4, 10)
zeros(2, 3)
zeros(25)
zeros(5)
ones(3, 5)
nines(3, 5)
ones(3, 5)
9*ones(3, 5)
mat1
mat2
zeros(size(mat2))
vet2
ones(size(vet2))
ones(length(vet2))
length(vet2)
size(vet2)
length(vet2)
ones(4)
ones(size(vet2))
size(vet2)
mat2
mat2'
1:3:10
(1:3:10)'
logspace(3, 1, 10)
mat3 = [(1+1i) 2; (2+4i) (2-9i); 10 1i]
mat3 = [(1+1i), (2); (2+4i), (2-9i); (10), (1i)]
mat3 = [(1+1i), (2); (2+4j), (2-9i); (10), (1i)]
mat3'
mat3.'
logspace(1, 3, 4)
format bank
logspace(1, 3, 4)
[1 2 3 4 5 6]
format short
[1 2 3 4 5 6]
log10(1000)