FIC MATLAB 2018-1/Aula-4

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
%-- 22-03-2018 19:06:47 --%
roots([1 1 -2])
log(2)
log10(100)
log2(1024)
% Mais comandos de plotagem
x = 0:0.1:10;
y = x.^2;
plot(x, y)
figure(2)
plot(x, cos(x))
hold on
plot(x, sin(x))
figure(1)
plot(x, -y)
figure(10)
hold on
plot(x, y)
plot(x, x)
close all
plot(x, x)
figure(1)
figure(2)
figure(3)
figure(4)
close(2)
close all
x
y
subplot(2, 3, 1)
plot(x, y)
subplot(2, 3, 5)
plot(x, cos(x))
hold on
plot(x, sin(x))
clf
subplot(2, 3, 1)
plot(x, y)
subplot(2, 3, 5)
plot(x, sin(x))
hold on
plot(x, cos(x))
subplot(2, 3, [3 6]])
subplot(2, 3, [3 6])
plot(x, x)
subplot(2, 2, 1)
figure
subplot(20, 13, 1)
clear all
close all
clc
% Numeros aleatorios
randi([10 15], 3, 4)
seed(0)
lookfor seed
rng(0)
randi([10 15], 3, 4)
rng(0)
rng(1)
randi([10 15], 3, 4)
doc rng
randi([10 15], 3, 4)
randi([0 1], 1, 10)
rand(2, 4)
rng(0)
rand(2, 4)
doc rng
rand(1, 10)
format compact
rand(1, 10)
randi([4 7], 1, 10)
rand([4 7], 1, 10)
rand(1, 10)
10*rand(4, 7)
rand(1, 10)
3*rand(1, 10) + 4
v = 3*rand(1, 1000) + 4;
min(v)
max(v)
v = 3*rand(1, 1000) + 4;
randi([0 10], 1, 10) + rand(1, 10)
rand(1, 10)
randn(2, 5)
rand(2, 4)
3*rand(2, 4) + 4
% Histograma
X = randi([0 10], 1, 1000);
hist(X)
doc hist
hist(X, 0:10)
X = randi([0 10], 1, 100000);
hist(X, 0:10)
hist(X, [2.5, 7.5])
doc hist
X = 3*rand(1, 100) + 4;
hist(X)
X = 3*rand(1, 100000) + 4;
hist(X)
X = randn(1, 100000);
hist(X)
hist(X, 30)
hist(X, 50)
Y = 10*X;
figure
hist(Y, 50)
Z = Y + 4
figure
hist(Z, 50)
A = rand(3, 5)
A
A(1, 3)
A(1, 3) = -1