0% found this document useful (0 votes)
326 views

Power Spectral Density (USED MATLAB)

The document discusses power spectral density (PSD) and its calculation using MATLAB. It begins by explaining the Fourier transform and its use in determining the frequency components of a signal. It then defines PSD as the amount of power per frequency interval. The document shows the results of calculating the PSD of a 12 Hz cosine signal using MATLAB code. The code generates the signal, takes its FFT, and plots the PSD with the highest value occurring at the signal frequency. It concludes by noting the code approximates the actual power using a Riemann sum.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
326 views

Power Spectral Density (USED MATLAB)

The document discusses power spectral density (PSD) and its calculation using MATLAB. It begins by explaining the Fourier transform and its use in determining the frequency components of a signal. It then defines PSD as the amount of power per frequency interval. The document shows the results of calculating the PSD of a 12 Hz cosine signal using MATLAB code. The code generates the signal, takes its FFT, and plots the PSD with the highest value occurring at the signal frequency. It concludes by noting the code approximates the actual power using a Riemann sum.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

SIGNAL PROCESSING POWER SPECTRAL DENSITY ( PSD )

Fourier Transform
The basis of the frequency characteristics of the signal is Fourier transform (Brook and
Wynne 1991). Fast Fourier Transform (FFT) is an algorithm for calculating Discrette Fourier
Transform (DFT). General function of the Fourier transform is to find the frequency components
of the signal that is hidden by a time domain signal filled with noise (Krauss et.al 1995) are:
S=fft (y)
(1)
S=fft(y,n)
(2)
(3)
(4)

In the equation, t is time and fh is the frequency. x is a signal notation in the space of time
and X is a notation for signals in the frequency domain. Equation (1) is called the Fourier
transform of x (t), while equation (2) is called the inverse Fourier transform of X (f), namely x
(t). Equation (1) can also be written as:
Cos(2_ft)+jSin(2_ft)

(5)

Fourier transformation can capture information whether a signal having a specific


frequency or not, but can not capture the frequency in which it occurs. Command form (3) and
(4) is almost the same, that compute the DFT of vector x, only the command (4) is added with
the use of the FFT length parameter (n).
Power Spectral Density
The frequency of a wave is naturally determined by the frequency source. The rate of the
wave through a medium is determined by the properties of the medium. Once the frequency (f)
and speed of sound (v) of the wave has been given, then the wavelength () has been set. With
the relationship f = 1 / T can be obtained equation (6).

(6)
Because the study used the speed of sound in the liquid medium, ie seawater.
Then the speed of sound in air is denoted by (v) can be changed with the speed of sound in water
that is denoted by (C), so that equation (7)
C

f
(7)
Power Spectral Density (PSD) is defined as the amount of power per frequency interval,
in the form of mate, tinkers (Brook and Wynne 1991):

By : MUHAMMAD ZAINUDDIN LUBIS , and PRATIWI DWI


WULANDARI

SIGNAL PROCESSING POWER SPECTRAL DENSITY ( PSD )


2

PSD =

Xn
f

( Amplitudo)
Hz

(8)

PSD calculations in MATLAB using Welch (Krauss et.al 1995), which is looking for a
DFT (based on calculations by the FFT algorithm), then squaring the magnitude value. Here are
the results of processing which is executed by using the syntax:

In the picture above shows the 10 cycles generated by syntax dijalakan using MATLAB,
the cycle is indicated by a blue line drawing. The cycle has the same value up to the value to
0007 with the remaining value on the y-axis is the range of 0 -1, because time is 1 / n / Fs. so that
the maximum value is generated by the cycle is 1.

In the picture above is shown the results of Power spectral density at a value of x (t) using
frequency is 12.000 Hz, while the value of Fs that is 2-fold greater the frequency in accordance
with the calculation in finding Frequency sample amounting to 24,000 Hz has the highest score
is at 0.004 with the axis x is worth 2500, and -2500, with its low point in 0002 the value of which

By : MUHAMMAD ZAINUDDIN LUBIS , and PRATIWI DWI


WULANDARI

SIGNAL PROCESSING POWER SPECTRAL DENSITY ( PSD )


is at 500 and -500, negative and positive center has charts the same highs and lows there is no
difference between the (+) and (-), with Power_of_x = 0.499995833333333

In the picture above is the power spectral density of x (t) with units of dB already
incorporated into the anti-log function 10 log (n), can be seen in the above picture has the same
pattern with the highest value on the y axis which is at -20 dB, with values which are at an
interval of 2500 and - 2500, it showed no difference between the peak value axis negative (-) and
the axis of the positive (+) with ans = 0.499995833333346, and the frequency used is 12:00 Hz
and frequency Sample is 24,000 Hz.
Syntax used :
clear all
close all
fs=24000; %Fs merupakan frekuensi sample
T=10; % time duration of the waveform, in sech
n=T*fs; % time is the vector of the sample time
time=(1:n)/fs; % waktu adalah vektor dari sampel waktu
f=12000/(2*pi);
x=cos(2*pi*f*time);
t=find(x<0);
x(t)=zeros(size(t)); % Ini merupakan gelombang terakhir/ penghabisan
x=sign(x);
t=find(x<0);
x(t)=zeros (size(t)); % penghabisan gelombang
sound(x/max(abs(x)),fs) % memulai panjangnya gelomnbang dalam sebuah file
%audio
figure (1)
plot (time,x)
axis([0 12/f -1.2 1.2]) %Hasil yang akan ditunjukkan adalah 12 siklus
title ('First few cycles of the waveform, x(t)');
grid on
%Penjumlahan energy dari sinyal waktu

By : MUHAMMAD ZAINUDDIN LUBIS , and PRATIWI DWI


WULANDARI

SIGNAL PROCESSING POWER SPECTRAL DENSITY ( PSD )


%Ini adalah aproksimasi penjumlahan Riemann dari rata-rata energi
%Catatan: Durasi, T=n*Ts, dimana Ts=1/Fs
Power_of_x=sum(x.^2)/n % Aproksimasi reimann dari persamaan integral
%lihat pada domain frekuensi
%Evaluasi FFT yang disebut dengan Discrete Fourier transform (DFT)
%at a set of equally space point on [0,1]
%
XFs=fft(x)/fs; % Skala fft pada spektrum x (t)
%
%Komputasi energy spektrum
%
Exf=abs(XFs).^2; % Note: Axf can also be computed as abs (XF).^2
%
%
Pxf=Exf/T;
%
%Persetujuan frekuensi yang akan digunakan di PSD
%
figure (2)
df=fs/n; % Df = Freq separation between two consecutive fft points
freq=[-(n/2)+1:1:n/2]*df;
maxPxf=max(Pxf);
subplot(211)
plot(freq,Pxf)
grid on
axis([-5000 5000 0 maxPxf])
title ( 'Power Spectral Density of x(t)');
subplot (212)
plot (freq,10*log10(Pxf/maxPxf),'r','LineWidth',0.5)
axis([-5000 5000 -100 0])
grid on
title ('Power Spectral Density of x(t) in dB');
%Calculating power from the PSD using Parseval's relation:
%i.e., power = integral of (Pxf) over all frequency
%This is a riemann sum approximation to the actual power
sum(Pxf)*df

Reference
Brook,D. and R.J. Wynne. 1991. Signal Processing: Principples and Applications. Edward
Arnold, a division of Hodder and Stoughton Limited, Mill Road, Dunton Green. Great
Britain.
Krauss,T.P.,L. Shure and J.N.Little 1995. Signal Processing Toolbox: For Use with Matlab. The
Mathworks, Inc.

By : MUHAMMAD ZAINUDDIN LUBIS , and PRATIWI DWI


WULANDARI

You might also like