Write a Matlab program to find the autocorrelation of the following signal :
g(t) = e-atu(t) , a > 0 .
Then , use the Wiener-Khintchine theorem to determine the energy spectral density of the signal .
Use this program to display the autocorrelation function and the energy spectral density .
%MATLAB CODE
clc;
clear all;
close all;
fs=1000;
t=0:1/fs:5;
a=0.9;
g=exp(-a*t);
[x,tau]=xcorr(g,g);
subplot(2,1,1)
plot(t,g)
xlabel('Time')
ylabel('Amplitude')
title('Input signal')
subplot(2,1,2)
plot(tau,x)
xlabel('Time')
ylabel('Amplitude')
title('Autocorrelation function of input signal')
%-------------------
figure;
k=0:length(tau)-1;
G=fft(x);
f=k*fs./(length(tau));
plot(-length(f)/2:length(f)/2-1,fftshift(abs(G)))
axis([-100 100 0 max(G)+10])
title('Energy spectral density')
xlabel('frequnecy in Hz')
ylabel('Magnitude')
Get Answers For Free
Most questions answered within 1 hours.