write a computer program to find the auto-correlation of any energy signal and to find its energy spectral density.
test your program the signal : tri(t/2).
MATLABCODE:
clc;
close all;
clear all;
T = -1:0.1:1; % Time vector
W = 1; % width of the triangulat pulse
tri = tripuls(T,W) ;
figure;plot(T,tri);grid;title('Energy signal: Triangular
pulse');
Acorr = autocorr(tri);
figure;plot(T,Acorr);grid;title('Autocorrelation of Triangular
pulse');
% Now take fourier transform of autocorrelation function
% For power spectral density
Fs = 10; % Sampling frequency
T = 1/Fs; % Sampling period
L = length(Acorr); % Length of signal
t = (0:L-1)T; % Time vector
Y = fft(Acorr);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2P1(2:end-1);
f = Fs*(0:(L/2))/L;
figure; plot(f,P1) ;grid;
title('Single-Sided Power Spectrum ')
xlabel('f (Hz)')
ylabel('|P1(f)|')
Get Answers For Free
Most questions answered within 1 hours.