Open Handed Lab Power Spectral Density: Objective

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Digital Signal Processing & Filter Open-Handed Lab

Open Handed Lab


POWER SPECTRAL DENSITY
OBJECTIVE:
To verify Power Spectral Density.

THEORY:
The power spectral density (P.S.D) is a measurement of the energy at various
frequencies. Usually we only care how much information is contained at a particular frequency and
we don’t really care whether it is part of the sine or cosine series. Therefore, we are interested in the
absolute value of the FFT coefficients. The absolute value will provide you with the total amount of
information contained at a given frequency, the square of the absolute value is considered the power
of the signal. Remember that the absolute value of the Fourier coefficients are the distance of the
complex number from the origin. To get the power in the signal at each frequency (commonly
called the power spectrum) you can try the following commands.

>> N = 8; %% number of points

>> t = [0:N-1]’/N; %% define time

>> f = sin(2*pi*t); %%define function

>> p = abs(fft(f))/(N/2); %% absolute value of the fft

>> p = p(1:N/2).^2 %% take the positve frequency half

This set of commands will return something much easier to understand, you should get 1
at a frequency of 1 and zeros everywhere else. Try substituting cos for sin in the above
commands, you should get the same result. Now try making >>f = sin(2*pi*t) + cos(2*pi*t).
This change should result in twice the power contained at a frequency of 1.

Thus far we have looked at data that is defined on the time interval of 1 second,
therefore we could interpret the location in the number list as the frequency. If the data is taken
over an arbitrary time interval we need to map the index into the Fourier series back to a
frequency in Hertz. The following m-file script will create something that might look like data
that we would obtain from a sensor.

Department of Telecommunication Engineering


Digital Signal Processing & Filter Open-Handed Lab

PROGRAM:
%Power spectral density
t = 0:0.001:0.6;
x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t));
subplot(2,1,1);
% figure(1);
plot(1000*t(1:50),y(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)');
Y = fft(y,512);
%The power spectral density, a measurement of the energy at various frequencies, is:
Pyy = Y.* conj(Y) / 512;
f = 1000*(0:256)/512;
subplot(2,1,2);
% figure(2);
plot(f,Pyy(1:257))
title('Frequency content of y');
xlabel('frequency (Hz)');

OUTPUT:

Department of Telecommunication Engineering


Digital Signal Processing & Filter Open-Handed Lab

OPEN HANDED LAB


POWER SPECTRAL DENSITY

INTRODUCTION:
The power spectral density (P.S.D) is a measurement of the energy at various
frequencies. Usually we only care how much information is contained at a particular frequency
and we don’t really care whether it is part of the sine or cosine series. Therefore, we are
interested in the absolute value of the FFT coefficients.

ABSTRACT:
The absolute value will provide you with the total amount of information contained at a
given frequency, the square of the absolute value is considered the power of the signal.
Remember that the absolute value of the Fourier coefficients are the distance of the complex
number from the origin. Thus far we have looked at data that is defined on the time interval of 1
second, therefore we could interpret the location in the number list as the frequency. If the data
is taken over an arbitrary time interval we need to map the index into the Fourier series back to
a frequency in Hertz. The following m-file script will create something that might look like data
that we would obtain from a sensor.

CONCLUSION:
In this lab, our main outcome was to get familiar with the Power Spectrum Density and
observe tit by plotting it in MATLAB. After the successful completion of this lab, we became
familiar with Power Spectral Density. Using our traditional coding techniques of MATLAB we
plotted the power density on the graphs and observed the outcome.

Department of Telecommunication Engineering

You might also like