FIC MATLAB 2019-1/Aula-2

De MediaWiki do Campus São José
Ir para: navegação, pesquisa
%-- 14-03-2019 19:10:49 --%
% Definição de vetores
vet1 = [1 4 8 -9 00]
format long
3.5
format short
3.5
format bank
3.5
format hat
format rat
3.5
pi
format long
355/113
pi
format compact
3.5
format
3.5
format compact
vet1 = [1 4 8 -9 00]
vet2 = [43, 81, 03, 2]
whos
% Definição de matrizes
mat1 = [1 3 7 12; 10 -12 0 1]
whos
mat2 = [1 3 7 12; 10 -12 0]
num1  = 0; num2 = 1; num3 = 99;
mat3 = [num1, num2; num3, num2 - num3]
% Verificação de tamanho de vetores e matrizes
length(vet1)
length(vet2)
length(mat1)
length(mat2)
length(mat3)
whos
size(mat1)
whos
mat1_tam = size(mat1)
size(mat1_tam)
mat1_tam
% Arranjo de vetores
% Antes disso
% Voltando pra vetores
vet3 = [34; 0; 99; 865]
length(VET3)
length(vet3)
size(vet3)
% Agora sim
% Vamos para arranjos
vet4 = 0:999999;
size(vet4)
vet4 = 0:11
vet4 = 0:15
vet5 = -3:8
vet6 = -3:0.5:2
vet6 = -3:2:20
vet3 = [34; 0; 99; a]
vet3 = [34; 0; 99; num1]
vet3 = [34; 0; 99; 'a']
vet3 = [34; 0; 99; -1]
vet3 = [34; 0; 99; -1; 4]
vet6 = -3:2:20
vet7 = [-3:2:20, 20]
vet7 = [-3:2:19, 20]
vet8 = 8:-2
vet8 = 8:-1:-2
vet9 = linspace(0,4,8)
doc linspace
vet9 = linspace(4,0,8)
vet10 = logspace(0,3,4)
vet10 = logspace(0,3,8)
doc logspace
x = randn(1,8)
prctile(x,99)
% Matrizes impoirtantes
M1 = eye(4)
M1 = eye(4,3)
M1 = eye(3,8)
M2 = zeros(3)
M2 = zeros(3,7)
tic; M2 = zeros(3,7); toc
tic; M2 = zeros(3,70); toc
M3 = ones(3)
M3 = ones(3,8)
M3 = ones(3,8) + 1
M3
size(M3)
zeros(3,8)
zeros(size(M3))
vet6
zeros(1,length(vet6))
zeros(length(vet6),1)
zeros(size(vet6))
vet6
vet6'
vet11 = [1+1i, 2+3i, 4-8i]
vet11'
% Hermitiana
vet11.'
vet6
vet6'
vet6.'
mat1
mat1'
logspace(log10(2),log10(1024),10)
format bank
logspace(log10(2),log10(1024),10)
logspace(log10(2),log10(1024),log10(1024)/log10(2))
logspace(0,4,5)
format long
logspace(0,4,5)
logspace(2,1024,5)
logspace(log10(2),log10(1024),10)
format bank
logspace(log10(2),log10(1024),10)
logspace(log10(2),log10(1024),log10(1024)/log10(2))
log10(logspace(log10(2),log10(1024),log10(1024)/log10(2)))/log10(2)
1:10
2^log10(logspace(log10(2),log10(1024),log10(1024)/log10(2)))/log10(2)
2.^log10(logspace(log10(2),log10(1024),log10(1024)/log10(2)))/log10(2)
2.^(log10(logspace(log10(2),log10(1024),log10(1024)/log10(2)))/log10(2)-1)
ini = 5; fim = 28; N = 10;
linspace(ini,fim,N)
format
linspace(ini,fim,N)
x = linspace(ini,fim,N)
y = ini : (fim-ini)/(N-1) : fim
ini = 5
fim = 28
fim = 28 N = 8
x1 = 28; x2 = 8
ini = 5; fim = 14; passo = 0.2;
z = ini : passo : fim;
size(z)
(fim - ini)/passo
(fim - ini)/(passo-1)
(fim - ini)/passo + 1
w = linspace(ini, fim, (fim-ini)/passo +1);
z
w
[z', w']
sum(abs(z - w))
lospace(1,3,50)
logspace(1,3,50)
log10(0.01)
uiimport