PRE-EngTel (página)

De MediaWiki do Campus São José
Revisão de 13h55min de 16 de dezembro de 2020 por Roberto.nobrega (discussão | contribs)
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para navegação Ir para pesquisar

MURAL DE AVISOS E OPORTUNIDADES DA ÁREA DE TELECOMUNICAÇÕES


Wiki desativada

A wiki se encontra em desuso, para acessar o material da materia acesse este link.

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, 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. 2.9, 3.8, 4.8 a 4.10.
8 12/09 Valor esperado. Teorema fundamental do valor esperado. Propriedades do valor esperado. Média, variância, desvio padrão. Yates, Sec. 2.5, 2.7, 2.8, 3.3.
9 16/09 Covariância e correlação. [O]. Yates, Sec. 4.7.
10 23/09 Variáveis aleatórias descorrelacionadas. Independência vs descorrelação. Coeficiente de Pearson. Yates, Sec. 4.7.
11 27/09 Vetores aleatórios. Vetor média e matriz covariância. Yates, Sec. 5.1, 5.2, 5.6.
12 30/09 Vetores aleatórios gaussianos. Definição. PDF conjunta. Exemplos [1]. Yates, Sec. 3.5, 5.7. Albuquerque, Cap. 6.
13 07/10 Prova #1.1.
14 10/10 Correção da Prova #1.1.
15 14/10 Exemplos [2]. Independência vs descorrelação para variáveis aleatórias conjuntamente gaussianas. Albuquerque, Cap. 6.
16 21/10 Participação na MCC.
17 22/10 Processos estocásticos contínuos e discretos. Especificação de processos estocásticos. Yates, Sec. 10.1, 10.2.
18 24/10 Função média, função autocorrelação e função autocovariância. Exemplos [1]. Yates, Sec. 10.8.
19 04/11 Exemplos [2]. Yates, Sec. 10.8.
20 09/11 Estacionariedade. Estacionariedade no sentido estrito. Estacionariedade no sentido amplo. Yates, Sec. 10.9, 10.10.
21 11/11 Sem aula devido à greve dos ônibus.
22 18/11 Prova #1.2.
23 21/11 Processos ESA. Função autocorrelação e densidade espectral de potência de processos ESA. Teorema de Wiener–Khinchine. Yates, Sec. 11.5.
24 25/11 Sem aula devido ao Movimento de Ocupação.
25 26/11 Resposta de sistemas lineares a entradas aleatórias. Yates, Sec. 11.8. Albuquerque, Sec. 7.10.
26 02/12 Processos estocásticos gaussianos. Yates, Sec. 10.12, Albuquerque, Sec. 7.11.
27 05/12 Cadeias de Markov. Introdução. Definição. Exemplos. Comportamento assintótico de cadeias de Markov. Yates, Sec. 12.1 a 12.3. Grinstead, Sec. 11.1, 11.2.

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(2)
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
Aula #9
N = 1e6;

U = randi([0 2], 1, N);
V = randi([0 2], 1, N);
X = U + V;
Y = U .* V;

u = 0:2;
freq_U = hist(U, u);
pmf_U_prat = freq_U / N;
pmf_U_teor = [1/3 1/3 1/3];

v = 0:2;
freq_V = hist(V, v);
pmf_V_prat = freq_V / N;
pmf_V_teor = [1/3 1/3 1/3];

freq_U_V = hist3([U' V'], [3 3]);
pmf_U_V_prat = freq_U_V / N;
pmf_U_V_teor = (1/9) * ones(3, 3);

x = 0:4;
freq_X = hist(X, x);
pmf_X_prat = freq_X / N;
pmf_X_teor = [1/9 2/9 3/9 2/9 1/9];

y = 0:4;
freq_Y = hist(Y, y);
pmf_Y_prat = freq_Y / N;
pmf_Y_teor = [5/9 1/9 2/9 0 1/9];

freq_X_Y = hist3([X' Y'], [5 5]);
pmf_X_Y_prat = freq_X_Y / N;
pmf_X_Y_teor = [1/9 0 0 0 0; 2/9 0 0 0 0; 2/9 1/9 0 0 0; 0 0 2/9 0 0; 0 0 0 0 1/9];


figure(1), clf
subplot(2,2,1), hold on, grid on
bar(u, pmf_U_prat, 'y', 0.5)
stem(u, pmf_U_teor, 'b', 'LineWidth', 2, 'MarkerSize', 8, 'MarkerFaceColor', 'auto')

subplot(2,2,2), hold on, grid on
bar(v, pmf_V_prat, 'y', 0.5)
stem(v, pmf_V_teor, 'b', 'LineWidth', 2, 'MarkerSize', 8, 'MarkerFaceColor', 'auto')

subplot(2,2,3), hold on, grid on
bar(x, pmf_X_prat, 'y', 0.5)
stem(x, pmf_X_teor, 'b', 'LineWidth', 2, 'MarkerSize', 8, 'MarkerFaceColor', 'auto')

subplot(2,2,4), hold on, grid on
bar(y, pmf_Y_prat, 'y', 0.5)
stem(y, pmf_Y_teor, 'b', 'LineWidth', 2, 'MarkerSize', 8, 'MarkerFaceColor', 'auto')

figure(2), clf
hold on, grid on
[um vm] = meshgrid(u, v);
my_bar3(pmf_U_V_prat, 0.5)
stem3(um(:), vm(:), pmf_U_V_teor(:), 'LineWidth', 2, 'MarkerSize', 12, 'MarkerFaceColor', 'auto')

figure(3), clf
hold on, grid on
[xm ym] = meshgrid(x, y);
my_bar3(pmf_X_Y_prat, 0.5)
stem3(xm(:), ym(:), pmf_X_Y_teor(:), 'LineWidth', 2, 'MarkerSize', 12, 'MarkerFaceColor', 'auto')

printf('E[U] = %f\n', mean(U))
printf('E[V] = %f\n', mean(V))
printf('E[U^2] = %f\n', mean(U.^2))
printf('E[V^2] = %f\n', mean(V.^2))
printf('var[U] = %f\n', var(U))
printf('var[V] = %f\n', var(V))
printf('E[UV] = %f\n', mean(U.*V))
printf('cov[U, V] = %f\n', cov(U, V))
printf('\n')

printf('E[X] = %f\n', mean(X))
printf('E[Y] = %f\n', mean(Y))
printf('E[X^2] = %f\n', mean(X.^2))
printf('E[Y^2] = %f\n', mean(Y.^2))
printf('var[X] = %f\n', var(X))
printf('var[Y] = %f\n', var(Y))
printf('E[XY] = %f\n', mean(X.*Y))
printf('cov[X, Y] = %f\n', cov(X, Y))
printf('\n')

Funções auxiliares:

my_bar3

Credits: Amro from Stack Overflow

function pp = my_bar3(M, width)
    % MY_BAR3  3D bar graph.
    %
    % M     - 2D matrix
    % width - bar width (1 means no separation between bars)
    %
    % See also: bar3, hist3

    %% construct patch
    if nargin < 2, width = 0.8; end
    assert(ismatrix(M), 'Matrix expected.')

    % size of matrix
    [ny,nx] = size(M);

    % first we build a "template" column-bar (8 vertices and 6 faces)
    % (bar is initially centered at position (1,1) with width=? and height=1)
    hw = width / 2;    % half width
    [X,Y,Z] = ndgrid([0-hw 0+hw], [0-hw 0+hw], [0 1]);
    v = [X(:) Y(:) Z(:)];
    f = [
        1 2 4 3 ; % bottom
        5 6 8 7 ; % top
        1 2 6 5 ; % front
        3 4 8 7 ; % back
        1 5 7 3 ; % left
        2 6 8 4   % right
    ];

    % replicate vertices of "template" to form nx*ny bars
    [offsetX,offsetY] = meshgrid(0:nx-1,0:ny-1);
    offset = [offsetX(:) offsetY(:)]; offset(:,3) = 0;
    v = bsxfun(@plus, v, permute(offset,[3 2 1]));
    v = reshape(permute(v,[2 1 3]), 3,[]).';

    % adjust bar heights to be equal to matrix values
    v(:,3) = v(:,3) .* kron(M(:), ones(8,1));

    % replicate faces of "template" to form nx*ny bars
    increments = 0:8:8*(nx*ny-1);
    f = bsxfun(@plus, f, permute(increments,[1 3 2]));
    f = reshape(permute(f,[2 1 3]), 4,[]).';

    %% plot
    % prepare plot
    if exist('OCTAVE_VERSION','builtin') > 0
        % If running Octave, select OpenGL backend, gnuplot wont work
        #graphics_toolkit('fltk');
        hax = gca;
    else
        hax = newplot();
        set(ancestor(hax,'figure'), 'Renderer','opengl')
    end


    % draw patch specified by faces/vertices
    % (we use a solid color for all faces)
    p = patch('Faces',f, 'Vertices',v, ...
        'FaceColor', 'y', 'EdgeColor','k', 'Parent',hax);
    view(hax,3); grid(hax,'on');
    set(hax, 'XTick',1:nx, 'YTick',1:ny, 'Box','off', 'YDir','reverse', ...
        'PlotBoxAspectRatio',[1 1 (sqrt(5)-1)/2]) % 1/GR (GR: golden ratio)

    % return handle to patch object if requested
    if nargout > 0
        pp = p;
    end
end

Arquivos

Material de apoio

Listas de exercícios

Formulário

Trabalhos

Links

  • Cálculo online da CDF da gaussiana (função Φ): [2]

Bibliografia

Professores anteriores


Curso de Engenharia de Telecomunicações