Docsity

Power Spectrum Analysis using SCI-LAB and MATLAB, Essays (university) of Matlab skills

Partial preview of the text

Download Power Spectrum Analysis using SCI-LAB and MATLAB and more Essays (university) Matlab skills in PDF only on Docsity!

POWER SPECTRUM USING

SCI-LAB

K.Divya sri 18761A ECE-B

INTRODUCTION:

 Power spectral density function show strength of the variations as a function of frequency.

 The unit of PSD is energy per frequency and you can obtain energy within a specific

frequency range by integrating PSD with that frequency range.

 It tells us where the average power is distributed as a function of frequency.

 The PSD is deterministic and for certain types of random signals is independent of time.

 The PSD is average of fourier transform magnitude squared over large time interval,

Sx(f) = {1/2T |dt|^2 }

 This describes how power of a signal or time series is distributed over frequency.

for i =1: length ( fk1 ) Pxx1_fk1 ( i ) = 0; Pxx2_fk1 ( i ) = 0; for m = 1: N Pxx1_fk1 ( i ) = Pxx1_fk1 ( i ) + x1 ( m ) * exp ( - sqrt ( -1) 2 %pi *( m -1) * fk1 ( i ) ) ; Pxx2_fk1 ( i ) = Pxx1_fk1 ( i ) + x1 ( m ) * exp ( - sqrt ( -1) 2 %pi *( m -1) * fk1 ( i ) ) ; End Pxx1_fk1 ( i ) = ( Pxx1_fk1 ( i ) ^2) / N ; Pxx2_fk1 ( i ) = ( Pxx2_fk1 ( i ) ^2) / N ; End for i =1: length ( fk2 ) Pxx1_fk2 ( i ) = 0; Pxx2_fk2 ( i ) = 0; for m = 1: N Pxx1_fk2 ( i ) = Pxx1_fk2 ( i ) + x1 ( m ) * exp ( - sqrt ( -1) 2 %pi *( m -1) * fk2 ( i ) ); Pxx2_fk2 ( i ) = Pxx1_fk2 ( i ) + x1 ( m ) * exp ( - sqrt ( -1) 2 %pi *( m -1) * fk2 ( i ) ) ;

end Pxx1_fk2 ( i ) = ( Pxx1_fk2 ( i ) ^2) / N ; Pxx2_fk2 ( i ) = ( Pxx1_fk2 ( i ) ^2) / N ; end figure (1) subplot (2 ,2 ,1) plot2d3 ( ’ gnn ’ ,k1 ,abs( Pxx1_fk1 ) ) xtitle ( ’ 8 p o i n t DFT ’ ) xlabel ( ’ k1 ’ ) ylabel ( ’ Power Spectrum ’ ) subplot (2 ,2 ,2) plot2d3 ( ’ gnn ’ ,k2 ,abs( Pxx1_fk2 ) ) xtitle ( ’ 16 point DFT ’ ) xlabel ( ’ k2 ’ ) ylabel ( ’ Power Spectrum ’ )

MATLAB PROGRAM:

Clc; Clear all; Close all; Fs=1000; T=0.1/fs:1-1/fs; X=cos(2pi100t)+cos(2pi150t); Figure(1) Plot(x) Grid on Title(‘time signal’) Xlabel(‘time (hz)’) Ylabel(‘amplitude’) N=length(x); Xdft=fft(x);

Xdft=xdft(1:N/2+1); Psdx=(1/(fsN))abs(xdft).^2; Psdx(2:end-1)=2psdx(2:end-1); Freq=0:fs/length(x):fs/2; Figure(2) Plot(freq,10log10(psdx)) Grid on Title(‘power spectral density’) Xlabel(‘frequency(hz)’) Ylabel(‘power/frequency(db/hz)’)

THANK YOU