FIC MATLAB 2018-2/Aula-3

De MediaWiki do Campus São José
Ir para: navegação, pesquisa
%-- 18-09-2018 19:02:28 --%
% Operações com matrizes
format compact
A = [1 2; 4 5]
B = [100 200; -100 -200]
A + B
C = [-11 17 13; 45 101 pi]
A + C
A - B
edit
A
A + 0.1
v = [4 6 8 9]
u = [1 2 3 4]
clear u
u = 1:4
v - u
v
v + 1000
v
u'
v + u'
A
A + ones(2,2)
A + 1
clc
A
B
D = A * B;
D
E = A .* B
clc
A
C
A * C
A .* C
C * A
v
u
v' * u
v .* u
v .* u'
v' .* u'
v * u'
A .+ B
A('.+ B')
A + B
A
A * 100
A .* 100
A * 100
A
B
A ./ B
A / B   % Mais tarde veremos!
A
A / 2
2 ./ A
2 / A
B / A
B ./ A
A
clc
A
A^2
A * A
A .^ 2
v
v^2
v .^ 2
A ./ B .* D
(A ./ B) .* D
A ./ (B .* D)
A
A ^ 0.5
ans * ans
A .^ 0.5
A .^ (-1)
clc
A
B
B^A
B .^ A
format bank
B .^ A
format short
A
cos(A)
C
cos(C)
v
u
sin(u)
log2(u)
A
sqrt(A)
A + 100
100 * A
C
sum(C)
v
sum(v)
sum(C)
C
sum(C')
sum(C')'
sum(A, 1)
sum(C, 1)
C
sum(C, 1)
sum(C, 2)
sum(C, 3)
clc
C
sum(C)
sum(sum(C))
doc sum
u
sum(u)
u'
sum(u')
A
prod(A)
prod(A, 2)
prod(prod(A))
pi
factorial(6)
C
min(C)
min(C, 2)
min(C, [], 2)
min(C)
min(C')'
u
min(u)
w = [17 11 13 45 -12 50]
min(w)
m = min(w)
[m ii] = min(w)
i
i = 40
i
clear i
i
1i
j
1j
w
w1 = [17 11 13 45 -12 -12 50]
m = min(w1)
[m ii] = min(w1)
C
min(min(C))
max(C)
A
u
sum(u)
sum(u) / length(u)
C
min(C)
[m ii] = min(C)
sum(u) / length(u)
mean(u)
C
mean(C)
u
std(u)
doc mean
lookfor deviation
u
norm(u)
y = [3 4]
norm(y)
A
det(A)
inv(A)
A * inv(A)
ans(2,1)
AA = [1:5; 6:10]
exp(1)
% Plots
t = 0:0.01:4*pi;
size(t)
s = cos(t);
size(s)
plot(t,s)
u
v
plot(u,v)
clc
u
v
clc
u = [1 2 4 3]
v
plot(u,v)
plot(t,s)
stem(t,s)
stem(u,v)
u = [1 2 3 4]
clc
u
v
stem(u,v)
stem(ones(size(v)),v)
bar(u,v)
stair(u,v)
stairs(u,v)
t2 = 0:0.3:4*pi;
t2 = 0:0.5:4*pi;
s2 = sin(t2);
stairs(t2,s2)
plot(t2,s2)
stem(t2,s2)
bar(t2,s2)
doc plot
comet(t2,s2)
comet(t,s)
u
v
plot(v)
u
plot(u,v)
u2 = [6 8 10 12];
plot(u2,v)
plot(v)
plot(u2,v)
plot(v)
plot(u2,v)
plot(v)
plot(u2,v)
plot(v)
plot(u2,v)
plot(v)
plot(u2,v)
plot(v)
v
plot(v)
plot(u2,v)
plot(v)
plot(u2,v)
plot(v)
plot(u2,v)
plot(v)
u3 = [1 2 3 4 5];
plot(u,v)
plot(u3,v)
t = linspace(-5,5,100);
f = t.^2;
plot(t,f)
plot(t,t.^2)
doc ezplot
plot(t,s)
t = 0:0.01:4*pi;
plot(t,s)
plot(t2,s2)
hold on
plot(t,s)
hold off
plot(t2,s2)
grid on
grid minor
xlabel('Eixo do tempo [s]')
ylabel('\Omega')
title('Gráfico para o professor Roberto')
figure
plot(t,s)
figure
figure(1)
figure(9)
bar(t2,s3)
bar(t2,s2)
axis([0 22 -2 0.5])
title('\pi')
xlim([0 20])
axis()
axis([]
axis([])]
axis([])
hold on
plot(t,s)
legend('Barra','Linha')
legend('Barra','Linha','teste')
legend('Barra')
close all
plot(t,s,'--')
plot(t,s,'-.')
plot(t,s,'.-')
plot(t,s,'-.')
legend('Teste')
plot(t,s,'-.r')
plot(t,s,'-.y')
plot(t,s,'-.yX')
plot(t,s,'-.kX')
plot(t,s,'-.kX','MarkerSize',8)
plot(t,s,'-.kX','MarkerSize',80)
whitebg('blue')
comet(t,s,'-.kX','MarkerSize',80)
comet(t,s)
comet(t,s,'r')
whitebg()
whitebg('white')
comet(t,s,'-.kh')
plot(t,s,'-.kh')
plot(t,s,'-.kh','MarkerSize',20)
subplot(2,3,1)
plot(t,s,'-.kh','MarkerSize',20)
subplot(2,1,2)
plot(t,s,'-.bh','MarkerSize',10)