Mudanças entre as edições de "PSD29007-Engtelecom(2018-1) - Prof. Marcos Moecke"
Ir para navegação
Ir para pesquisar
Linha 19: | Linha 19: | ||
:EXEMPLOS: | :EXEMPLOS: | ||
* Leia com atenção e execute o exemplo (Moving-Avarage Filter) na página de help da função [http://www.mathworks.com/help/matlab/ref/filter.html filter]. | * Leia com atenção e execute o exemplo (Moving-Avarage Filter) na página de help da função [http://www.mathworks.com/help/matlab/ref/filter.html filter]. | ||
− | * Leia com atenção o help [https://www.mathworks.com/help/matlab/examples/using-fft.html Using FFT], abra o script clicando no botão [Open this Example]. Execute o | + | * Leia com atenção o help [https://www.mathworks.com/help/matlab/examples/using-fft.html Using FFT], abra o script clicando no botão ['''Open this Example''']. Execute o script seção após seção. Note o uso da fft para determinar a frequência das manchas solares. |
* Para melhorar o desempenho no Matlab recomendo que leiam a pagina do [http://www.mathworks.com/help/matlab/learn_matlab/help.html Help], . Também gostaria de lembra-los que a tecla F9 executa o código destacado no Help. [http://www.mathworks.com/help/matlab/learn_matlab/scripts.html Programação com scripts .m]. | * Para melhorar o desempenho no Matlab recomendo que leiam a pagina do [http://www.mathworks.com/help/matlab/learn_matlab/help.html Help], . Também gostaria de lembra-los que a tecla F9 executa o código destacado no Help. [http://www.mathworks.com/help/matlab/learn_matlab/scripts.html Programação com scripts .m]. | ||
− | :'''DICAS:''' | + | :'''DICAS:''' |
+ | *No help on-line da Matworks, usando o botão ['''Try This Example > Try in your browser'''], permite executar o código no próprio browser sem ter nenhuma instalação do Matlab. Para verificar que o código realmente é executado mude a amplitude do ruído randômico para 0.1 ou 0.5, insira o comando '''close all''' antes da primeira linha, e execute todo o código ['''Run All'''] | ||
+ | *No help do Matlab, usando o botão ['''Open this Example'''], é possível executar o código seção a seção. | ||
+ | |||
+ | :* Leia sobre [https://en.wikipedia.org/wiki/Sunspot manchas solares] para entender o que são os dados do segundo exemplo. | ||
+ | |||
+ | ;Aula 3 (23 fev): | ||
+ | <syntaxhighlight lang=matlab> | ||
+ | %% Signal in Time Domain | ||
+ | % Use Fourier transforms to find the frequency components of a signal buried in noise. | ||
+ | % Specify the parameters of a signal with a sampling frequency of 1 kHz and a signal duration of 1.5 seconds | ||
+ | Fs = 1000; % Sampling frequency | ||
+ | T = 1/Fs; % Sampling period | ||
+ | L = 1500; % Length of signal | ||
+ | t = (0:L-1)*T; % Time vector | ||
+ | |||
+ | % Form a signal containing a 50 Hz sinusoid of amplitude 0.7 and a 120 Hz sinusoid of amplitude 1. | ||
+ | S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); | ||
+ | |||
+ | % Corrupt the signal with zero-mean white noise with a variance of 4. | ||
+ | X = S + 2*randn(size(t)); | ||
+ | |||
+ | % Plot the noisy signal in the time domain. It is difficult to identify the frequency components by looking at the signal X(t). | ||
+ | subplot(211); | ||
+ | plot(1000*t(1:200),X(1:200)) | ||
+ | title('Signal Corrupted with Zero-Mean Random Noise') | ||
+ | xlabel('t (milliseconds)') | ||
+ | ylabel('X(t)') | ||
+ | |||
+ | %% Signal in Frequency Domain | ||
+ | % Compute the Fourier transform of the signal. | ||
+ | Y = fft(X); | ||
+ | |||
+ | % Compute the two-sided spectrum P2. Then compute the single-sided spectrum P1 based on P2 and the even-valued signal length L. | ||
+ | P2 = abs(Y/L); | ||
+ | P1 = P2(1:L/2+1); | ||
+ | P1(2:end-1) = 2*P1(2:end-1); | ||
+ | |||
+ | % Define the frequency domain f and plot the single-sided amplitude spectrum P1. | ||
+ | % The amplitudes are not exactly at 0.7 and 1, as expected, because of the added noise. | ||
+ | % On average, longer signals produce better frequency approximations. | ||
+ | f = Fs*(0:(L/2))/L; | ||
+ | subplot(212); | ||
+ | plot(f,P1) | ||
+ | ylim([0 1.05]) | ||
+ | title('Single-Sided Amplitude Spectrum of X(t)') | ||
+ | xlabel('f (Hz)') | ||
+ | ylabel('|P1(f)|') | ||
+ | |||
+ | % Now, take the Fourier transform of the original, uncorrupted signal and retrieve the exact amplitudes, 0.7 and 1.0. | ||
+ | Y = fft(S); | ||
+ | P2 = abs(Y/L); | ||
+ | P1 = P2(1:L/2+1); | ||
+ | P1(2:end-1) = 2*P1(2:end-1); | ||
+ | |||
+ | plot(f,P1) | ||
+ | title('Single-Sided Amplitude Spectrum of S(t)') | ||
+ | xlabel('f (Hz)') | ||
+ | ylabel('|P1(f)|') | ||
+ | </syntaxhighlight> | ||
+ | FONTE: https://www.mathworks.com/help/matlab/ref/fft.html | ||
+ | |||
<!-- | <!-- | ||
− | |||
:* Resposta de sistemas LTI (Experimento 1.1) | :* Resposta de sistemas LTI (Experimento 1.1) | ||
::* Relembrar o conceito de equação de diferenças de um sistema LTI discreto e resposta ao impulso. | ::* Relembrar o conceito de equação de diferenças de um sistema LTI discreto e resposta ao impulso. |
Edição das 14h28min de 21 de fevereiro de 2018
Registro on-line das aulas
Unidade 1 |
---|
Unidade 1
%% Signal in Time Domain
% Use Fourier transforms to find the frequency components of a signal buried in noise.
% Specify the parameters of a signal with a sampling frequency of 1 kHz and a signal duration of 1.5 seconds
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
% Form a signal containing a 50 Hz sinusoid of amplitude 0.7 and a 120 Hz sinusoid of amplitude 1.
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
% Corrupt the signal with zero-mean white noise with a variance of 4.
X = S + 2*randn(size(t));
% Plot the noisy signal in the time domain. It is difficult to identify the frequency components by looking at the signal X(t).
subplot(211);
plot(1000*t(1:200),X(1:200))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('t (milliseconds)')
ylabel('X(t)')
%% Signal in Frequency Domain
% Compute the Fourier transform of the signal.
Y = fft(X);
% Compute the two-sided spectrum P2. Then compute the single-sided spectrum P1 based on P2 and the even-valued signal length L.
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
% Define the frequency domain f and plot the single-sided amplitude spectrum P1.
% The amplitudes are not exactly at 0.7 and 1, as expected, because of the added noise.
% On average, longer signals produce better frequency approximations.
f = Fs*(0:(L/2))/L;
subplot(212);
plot(f,P1)
ylim([0 1.05])
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
% Now, take the Fourier transform of the original, uncorrupted signal and retrieve the exact amplitudes, 0.7 and 1.0.
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
plot(f,P1)
title('Single-Sided Amplitude Spectrum of S(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
|
Avaliações
- Entrega dos diversas Atividades Extraclasse ao longo do semestre.
- Entrega do Projeto Final. O projeto é avaliado nos quesitos:
- 1) Implementação do Sistema,
- 2) Documentação,
- 3) Avaliação Global do aluno no projeto.
- Entrega dos Atividades Extraclasse ao longo do semestre AE1 a AE(N). A entrega, detalhes e prazos de cada AE serão indicados na plataforma Moodle
AE1 - Revisão de Sinais e Sistemas (prazo e forma de entrega ver na plataforma AVA) |
---|
|
Referências Bibliográficas