Autocorrelation and Energy Spectral Density Usin MATLAB

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Experiment No.

3
Autocorrelation and Energy Spectral Density of a
deterministic Energy signal

Generation of Rectangular Pulse Signal:


n = -2:1:2;
x =[1 1 1 1 1];
stem(n,x,'r','filled');
title('Pulse Signal');
xlabel ('Time Sampling');
ylabel('Magnitude') grid on
axis([-2.5 2.5 0 1.2])

Expression of DTFT with amplitude and Phase Plot:


w = -2*pi:0.001:2*pi; % W from -2pi to 2pi
A = 1*exp(1i*2*w) + 1*exp(1i*1*w) + 1 + 1*exp(-1i*1*w) + 1*exp(-1i*2*w);
plot(w/pi,abs(A),'r') xlabel('w/pi (-2pi to 2pi)') ylabel('Amplitude
|A|') title('Magnitude Plot') grid on axis([-2 2 0 5.2])

h = freqz(x,1,w);
plot(w/pi,angle(h))
xlabel('w/pi (-2pi to 2pi)')
ylabel('Phase') title('Phase
Plot') grid on
Energy Spectral Density:
Suu = abs(h.^2) %Finding ESD of above signal
plot(Suu,"MarkerSize",12) ylabel('Amplitude |A|') title('Energy
Spectral Density') grid on
axis([0 12700 0 26])
Autocorrelation of Pulse Signal and DTFT expression:
Auto_co = xcorr(x,x)
Ruu = vpa(Auto_co,2)

Ruu =
p = 1*exp(-1i*1*w) + 2*exp(-1i*2*w) + 3*exp(-1i*3*w) + 4*exp(-1i*4*w) +
5*exp(-1i*5*w)+ 4*exp(-1i*6*w)+ 3*exp(-1i*7*w)+ 2*exp(-1i*8*w)+ 1*exp(-
1i*9*w); plot(p)
ylabel('Amplitude |A|')
title('DTFT of Ruu')
grid on
axis([0 12700 0 26]) %Hence DTFT OF Ruu and Suu are same

You might also like