FIC MATLAB 2018-1/Aula-14

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
%-- 26-04-2018 19:05:36 --%
% Importação de dados
uiimport
Dez15
Dez15{1}
Dez15{2}
Celular4g
Celular4g(1, :)
Celular4g(end, :)
% Gráficos 2D
clc
w = logspace(-3, 3, 1000);
H = 1 / sqrt(1 + w.^2);
H = 1 ./ sqrt(1 + w.^2);
plot(w, H)
semilogx(w, H)
grid on
semilogy(w, H)
grid on
loglog(w, H)
grid on
loglog(w, H, 'o-')
w = logspace(-3, 3, 100);
loglog(w, H, 'o-')
H = 1 ./ sqrt(1 + w.^2);
loglog(w, H, 'o-')
semilogx(w, H, 'o-')
W = log10(w)
H_linha = 1 ./ sqrt(1 + W.^2);
plot(W, H_linha)
plot(W, H);
plot(W, H, '-o');
w = linspace(0.001, 1000, 100);
H = 1 ./ sqrt(1 + w.^2);
semilogx(w, H, 'o-')
w = linspace(0.001, 1000, 10000);
H = 1 ./ sqrt(1 + w.^2);
semilogx(w, H, 'o-')
% Coordenadas polares
t = linspace(0, 3, 100)
plot(t, t)
polar(t, t)
t = linspace(0, 2*pi, 1000);
r = cos(2*t);
polar(t, r);
polar(t, cos(3*t));
t = linspace(0, 6*pi); polar(t, cos(3*t));
t = linspace(0, 6*pi, 1000); polar(t, cos(3*t));
t = linspace(0, 6*pi, 1000); polar(t, cos(5*t));
t = linspace(0, 6*pi, 1000); polar(t, cos(8*t));
t = linspace(0, 6*pi, 1000); polar(t, cos((5/4)*t));
t = linspace(0, 60*pi, 1000); polar(t, cos((5/4)*t));
t = linspace(0, 60*pi, 1000); comet(t, cos((5/4)*t));
x = linspace(0, 10, 1000);
g = 1000*x.^2 + 500*sin(x);
f = abs(x - 5);
plot(x, g)
g = 10*x.^2 + 500*sin(x);
plot(x, g)
hold on
plot(x, f)
plotyy(x, g, f)
plotyy(x, g, x, f)
plot(x, g)
xlabel('\lambda')
xlabel('\lambda + \alpha é igual a \beta')
ylabel('\frac{1}{\pi}')
ylabel('\frac{1}{2}')
ylabel('\xi')
ylabel('\Xi')
ylabel('\Xi|')
ylabel('\Xi-')
% Plot 3D
t = linspace(0,12*pi,1000);
x = cos(t);
y = sin(t);
plot(x,y)
z = t;
plot3(x,y,z)
xlabel('x'); ylabel('y'); zlabel('z')
grid on
zlabel('H')
zlabel('P')
comet3(x,y,z)
while true; comet3(x,y,z); pause(0.5); end
view(40,40)
view(42,40)
view(50,40)
figure
plot(x,y)
ii = 1;
view(45,45)
[X,Y] = meshgrid([-2 0 2],[1 2 3 4])
[X,Y] = meshgrid([-2 0 2])
mesh(X,Y,1)
[X,Y] = meshgrid([-2 0 2],[1 2 3 4])
mesh(X,Y,ones(size(X)))
axis equal
xlabel('x'); ylabel('y'); zlabel('z')
Z = ones(size(X))
X
Y
mesh(X,Y,Z)
axis equal
xlabel('x'); ylabel('y'); zlabel('z')
Z = [1 1 1
1 2 1
Z = [
1 1 1
1 2 1
1 1 0
1
Z = [1 1 1; 1 2 1; 1 1 0; 1 1 1]
mesh(X,Y,Z)
axis equal; xlabel('x'); ylabel('y'); zlabel('z')
[X,Y] = meshgrid(-20:0.5:20);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
surf(X,Y,Z)
axis equal; xlabel('x'); ylabel('y'); zlabel('z')
surf(X,Y,Z)
mesh(X,Y,Z)
surf(X,Y,Z)
shading flat
shading faceted
shading interp
contour(X,Y,Z)
surfc(X,Y,Z)
meshc(X,Y,Z)
[Gx, Gy, Gz] = sphere
surf(X, Y, 20*Z); hold on; surf(4*Gx, 4*Gy, 4*Gz + 22); axis equal
[Gx, Gy, Gz] = sphere;
surf(X, Y, 20*Z); hold on; surf(4*Gx, 4*Gy, 4*Gz + 30); axis equal
[Gx, Gy, Gz] = sphere;
surf(X, Y, 20*Z); hold on; surf(4*Gx, 4*Gy, 4*Gz + 25); axis equal; shading interp
% Exercícios
x = imread('imagem1.jpeg');
figure
size(x)
[X,Y] = meshgrid(1:599,1:507);
z = imread('imagem1.jpeg');
surf(X,Y,z)
size(z)
size(X)
size(Y)
surf(X',Y',z)
shading flat
figure
surf(X,Y,z')
shading flat
view(90,90)
size(z)
shading interp
colormap('rainbow')
doc colormap
colormap winter
colormap summer
edit animacaum.m
animacaum
edit msc.m
msc
cd ..
msc