Mudanças entre as edições de "PRE-EngTel (página)"
Ir para navegação
Ir para pesquisar
Linha 204: | Linha 204: | ||
plot(x, cdf_prat) | plot(x, cdf_prat) | ||
ylim([-0.1 1.1]) | ylim([-0.1 1.1]) | ||
+ | grid on | ||
+ | </syntaxhighlight> | ||
+ | {{collapse bottom}} | ||
+ | |||
+ | {{collapse top | Aula #7}} | ||
+ | <syntaxhighlight lang=matlab> | ||
+ | close all | ||
+ | |||
+ | N = 10000; | ||
+ | |||
+ | X = zeros(1, N); | ||
+ | Y = zeros(1, N); | ||
+ | ii = 1; | ||
+ | while ii <= N | ||
+ | X(ii) = 2*rand() - 1; | ||
+ | Y(ii) = 2*rand() - 1; | ||
+ | if X(ii)^2 + Y(ii)^2 <= 1; | ||
+ | ii += 1; | ||
+ | end | ||
+ | end | ||
+ | |||
+ | y = linspace(-1.2, 1.2, 100); | ||
+ | freq_Y = hist(Y, y); | ||
+ | pdf_Y_prat = freq_Y / trapz(y, freq_Y); | ||
+ | pdf_Y_teor = (2/pi) * sqrt(1 - y.^2) .* ((-1 <= y) & (y <= 1)); | ||
+ | |||
+ | xc = 0.8; | ||
+ | Yc = zeros(1, N); | ||
+ | ii = 1; | ||
+ | while ii <= N | ||
+ | Yc(ii) = 2*rand() - 1; | ||
+ | if xc^2 + Yc(ii)^2 <= 1 | ||
+ | ii += 1; | ||
+ | end | ||
+ | end | ||
+ | |||
+ | freq_Yc = hist(Yc, y); | ||
+ | pdf_Yc_prat = freq_Yc / trapz(y, freq_Yc); | ||
+ | pdf_Yc_teor = 1 / (2*sqrt(1 - xc^2)) .* (abs(y) <= sqrt(1 - xc^2)); | ||
+ | |||
+ | figure(1) | ||
+ | scatter(X, Y) | ||
+ | axis('equal') | ||
+ | grid on | ||
+ | |||
+ | figure(2) | ||
+ | hold on | ||
+ | bar(y, pdf_Y_prat, 'y') | ||
+ | plot(y, pdf_Y_teor, 'b--', 'linewidth', 4) | ||
+ | axis('equal') | ||
+ | grid on | ||
+ | |||
+ | figure(3) | ||
+ | hold on | ||
+ | bar(y, pdf_Yc_prat, 'y') | ||
+ | plot(y, pdf_Yc_teor, 'b--', 'linewidth', 4) | ||
+ | axis('equal') | ||
grid on | grid on | ||
</syntaxhighlight> | </syntaxhighlight> |
Edição das 10h54min de 9 de setembro de 2016
MURAL DE AVISOS E OPORTUNIDADES DA ÁREA DE TELECOMUNICAÇÕES
Informações gerais
Aulas
N | Dia | Desenvolvimento | Leitura recomendada |
---|---|---|---|
1 | 12/08 | Plano de ensino. Definição de variáveis aleatória. Variáveis aleatórias discretas. Função massa de probabilidade (PMF). [O]. | Yates, Sec. 2.2 e 2.1 |
2 | 15/08 | Propriedades da PMF. Algumas distribuições de probabilidade discretas. [O]. | Yates, Sec. 2.3 |
3 | 19/08 | Variáveis aleatórias contínuas. Função densidade de probabilidade (PDF). Propriedades da PDF. Algumas distribuições de probabilidade contínuas. | Yates, Sec. 3.2, 3.4. |
4 | 26/08 | [O]. Função de distribuição acumulada (CDF). | Yates, Sec. 2.4, 3.1. |
5 | 29/08 | PDF para variáveis aleatórias discretas. Variáveis aleatórias mistas. [O]. | Yates, Sec. 3.6. |
6 | 02/09 | PDF conjunta e marginal. CDF conjunta e marginal. | Yates, Sec. 4.1 a 4.5. |
7 | 09/09 | PDF condicional. [O]. Variáveis aleatórias independentes. | Yates, Sec. 4.8 a 4.10. |
Simulações
Aula #1 |
---|
N = 1000; % Número de experimentos
D1 = randi([1 6], 1, N); % Dado 1
D2 = randi([1 6], 1, N); % Dado 2
X = D1 + D2; % Variável aleatória de interesse
x = 2:12; % Centros dos bins
freq = hist(X, x); % Histograma de X
pmf_prat = freq / N; % PMF prática a partir do histograma
pmf_teor = [1 2 3 4 5 6 5 4 3 2 1] / 36; % PMF teória calculada em sala de aula
% Plots
figure
hold on
stem(x, pmf_prat, 'r')
stem(x, pmf_teor, 'b')
grid on
|
Aula #2 |
---|
N = 10000;
X = zeros(1, N);
for ii = 1 : N
count = 0;
while 1
D = randi([1 6]);
count += 1;
if D == 6
break
end
end
X(ii) = count;
end
x = 1 : max(X);
freq = hist(X, x);
pmf_prat = freq/N;
pmf_teor = (5/6).^(x-1) * (1/6);
figure
hold on
stem(x, pmf_prat, 'r')
stem(x, pmf_teor, 'b')
grid on
prob_a_prat = sum(X <= 3) / N
prob_a_teor = 91/216
prob_b_prat = sum(X >= 6) / N
prob_b_teor = 3125/7776
prob_c_prat = sum(mod(X, 2) == 1) / N
prob_c_teor = 6/11
prob_d_prat = length(findstr(X, [1 1])) / N
prob_d_teor = 1/36
|
Aula #4 |
---|
close all
N = 10000;
sigma = 5;
X = randn(1, N) * sigma;
Y = randn(1, N) * sigma;
Z = X + 1j*Y;
R = abs(Z);
T = angle(Z);
x = linspace(-25, 25, 100);
freq_X = hist(X, x);
pdf_X_prat = freq_X / trapz(x, freq_X);
pdf_X_teor = 1/sqrt(2*pi*sigma^2) * exp(-x.^2 / (2*sigma^2));
y = linspace(-25, 25, 100);
freq_Y = hist(Y, y);
pdf_Y_prat = freq_Y / trapz(y, freq_Y);
pdf_Y_teor = 1/sqrt(2*pi*sigma^2) * exp(-y.^2 / (2*sigma^2));
r = linspace(-1, 25, 100);
freq_R = hist(R, r);
pdf_R_prat = freq_R / trapz(r, freq_R);
pdf_R_teor = r/(sigma^2) .* exp(-r.^2 / (2*sigma^2)) .* (r > 0);
t = linspace(-3.5, 3.5, 100);
freq_T = hist(T, t);
pdf_T_prat = freq_T / trapz(t, freq_T);
pdf_T_teor = 1 / (2*pi) * ((-pi <= t) & (t <= pi));
r2 = linspace(-10, 400, 100);
freq_R2 = hist(R.^2, r2);
pdf_R2_prat = freq_R2 / trapz(r2, freq_R2);
pdf_R2_teor = 1/(2*sigma^2) * exp(-r2 / (2*sigma^2)) .* (r2 > 0);
figure(1)
scatter(X, Y)
axis('equal')
grid on
figure(3)
subplot(1,2,1)
hold on
bar(x, pdf_X_prat, 'y')
plot(x, pdf_X_teor, 'b--', 'linewidth', 4)
xlim([x(1) x(end)])
grid on
subplot(1,2,2)
hold on
bar(y, pdf_Y_prat, 'y')
plot(y, pdf_Y_teor, 'b--', 'linewidth', 4)
xlim([y(1) y(end)])
grid on
figure(3)
subplot(2,2,1)
hold on
bar(r, pdf_R_prat, 'y')
plot(r, pdf_R_teor, 'b--', 'linewidth', 4)
xlim([r(1) r(end)])
grid on
subplot(2,2,2)
hold on
bar(t, pdf_T_prat, 'y')
plot(t, pdf_T_teor, 'b--', 'linewidth', 4)
xlim([t(1) t(end)])
grid on
subplot(2,2,3)
hold on
bar(r2, pdf_R2_prat, 'y')
plot(r2, pdf_R2_teor, 'b--', 'linewidth', 4)
xlim([r2(1) r2(end)])
grid on
|
Aula #5 |
---|
close all
N = 10000;
X = zeros(1, N);
for ii = 1 : N
U = 4*rand();
if U <= 1
X(ii) = 2*rand();
else
X(ii) = (rand() < 2/3);
end
end
x = linspace(-1, 3, 100);
freq = hist(X, x);
pdf_prat = freq / trapz(x, freq);
cdf_prat = cumsum(freq) / N;
figure
plot(x, pdf_prat)
grid on
figure
plot(x, cdf_prat)
ylim([-0.1 1.1])
grid on
|
Aula #7 |
---|
close all
N = 10000;
X = zeros(1, N);
Y = zeros(1, N);
ii = 1;
while ii <= N
X(ii) = 2*rand() - 1;
Y(ii) = 2*rand() - 1;
if X(ii)^2 + Y(ii)^2 <= 1;
ii += 1;
end
end
y = linspace(-1.2, 1.2, 100);
freq_Y = hist(Y, y);
pdf_Y_prat = freq_Y / trapz(y, freq_Y);
pdf_Y_teor = (2/pi) * sqrt(1 - y.^2) .* ((-1 <= y) & (y <= 1));
xc = 0.8;
Yc = zeros(1, N);
ii = 1;
while ii <= N
Yc(ii) = 2*rand() - 1;
if xc^2 + Yc(ii)^2 <= 1
ii += 1;
end
end
freq_Yc = hist(Yc, y);
pdf_Yc_prat = freq_Yc / trapz(y, freq_Yc);
pdf_Yc_teor = 1 / (2*sqrt(1 - xc^2)) .* (abs(y) <= sqrt(1 - xc^2));
figure(1)
scatter(X, Y)
axis('equal')
grid on
figure(2)
hold on
bar(y, pdf_Y_prat, 'y')
plot(y, pdf_Y_teor, 'b--', 'linewidth', 4)
axis('equal')
grid on
figure(3)
hold on
bar(y, pdf_Yc_prat, 'y')
plot(y, pdf_Yc_teor, 'b--', 'linewidth', 4)
axis('equal')
grid on
|
Arquivos
Listas de exercícios
Formulário
Trabalhos
- (Em breve.)
Bibliografia
- Yates, Roy D.; Goodman, David J. Probability and Stochastic Processes: A Friendly Introduction for Electrical and Computer Engineers, 2nd Ed., 2005.
- Albuquerque, J.P.A.; Fortes, J.M.P.; Finamore, W.A. Probabilidade, Variáveis Aleatórias e Processos Estocásticos, 2008.
- Grinstead, Charles M.; Snell, J. Laurie. Introduction to Probability, 2006.
Professores anteriores
- 2016-1: Roberto Wanderley da Nóbrega
- 2015-2: Roberto Wanderley da Nóbrega
- 2015-1: Roberto Wanderley da Nóbrega
- 2014-2: Roberto Wanderley da Nóbrega