FIC MATLAB 2017-1/Aula-10

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
%-- 05-04-2017 19:07:55 --%
clc
x = 0:0.01:4*pi
4*pi
y = cos(x)
plot(x, y)
hold on
z = sin(x);
stem(x, z)
x
x(1:50:end)
z(1:50:end)
hold off
hold on
subplot(2,1,2)
stem(x(1:50:end), z(1:50:end))
hold on
plot(x, z, 'r')
bars(x(1:100:end), z(1:100:end))
bar(x(1:100:end), z(1:100:end))
z(1)
clear all
x = 0:8
y = x.^2
plot(x, y)
grid on
hold on
stairs(x, y)
clc
clear
x = 1 : 0.1 : 1000;
y = 1 / (1 + x^2)
y = 1 / (1 + x.^2)
y = 1 ./ (1 + x.^2);
subplot(2,2,1)
plot(x,y)
grid on
subplot(2,2,2)
semilogx(x, y)
grid on
subplot(2,2,3)
semilogy(x, y)
grid
subplot(2,2,4)
loglog(x, y)
grid on
loglog(x, y, 'bo')
x = 1 : 1 : 1000;
y = 1 ./ (1 + x.^2);
loglog(x, y, 'bo')
x = logspace(0, 3, 1000);
y = 1 ./ (1 + x.^2);
loglog(x, y, 'bo')
x = 1 : 1 : 50;
y = 1 ./ (1 + x.^2);
loglog(x, y, 'bo')
x = logspace(0, 3, 50);
y = 1 ./ (1 + x.^2);
loglog(x, y, 'bo')
rad2deg(pi/6)
lookfor degree
rad2deg(pi/6)
convert2deg (pi/6)
t = 0:0.01:6*pi;
r = linspace(1, 0, length(t));
help polar
polar(t, r)
figure
plot(t, r)
r = logspace(1, 0, length(t));
polar(t, r)
figure
plot(t, r)
%-- 05-04-2017 20:50:05 --%
clc
x = linspace(0, 4*pi, 1000);
y = 2*sin(x);
z = 30*cos(2*x);
plotyy(x, y, x, z)
legend('tensao (V)', 'corrente (mA)')
doc plotyy
help comet
doc comet
t = 0:.01:2*pi;
x = cos(2*t).*(cos(t).^2);
y = sin(2*t).*(sin(t).^2);
comet(x,y);
clc
% Plots em 3D
t = 0:0.1:10*pi;
x = cos(t);
y = sin(t);
z = t;
figure
plot3(x,y,z)
grid on
xlabel('x'); ylabel('y'); zlabel('z')
view(-90,0)
view(0,0)
% Grade 3D
[X,Y] = meshgrid(-5:5);
x = -5:5;
y = 0:4;
x
y
clc
x = -5:5
y = 0:4
[X,Y] = meshgrid(x,y)
[X,Y] = meshgrid(x)
[X,Y] = meshgrid(-20:0.5:20);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
mesh(X,Y,Z)
eps
surf(X,Y,Z)
shading flat
shading faceted
shading interp
shading flat
shading interp
surfc(X,Y,Z)
contour(X,Y,Z)
surfc(X,Y,Z)
meshc(X,Y,Z)
surfc(X,Y,Z)
shading interp
meshz(X,Y,Z)
waterfall(X,Y,Z)