DSP C PROGRAM Convolution and Correlation - Computer Programming

# Computer Programming

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

## Thursday, November 10, 2011

Convolution and Correlation

AIM:- To find convolution and correlation of signals

THEORY: - If input is given to any system, output from the system is nothing  but convolution of input time signal and the system impulse response. Convolution in time domain is same as multiplication in frequency domain. Correlation is measurement of similarity. Cross correlation gives the similarity between two different signals whereas autocorrelation gives the similarity of the signal when the same signal was delayed. Fourier transform of autocorrelation is power spectral density of the signal (PSD)

PROGRAM: -

x = [ 1 1 -1 1 -1 -1 ];
h = [ -1 -1 1 -1 -1 -1 ];
y = conv( x, h )
cr = xcorr ( x , h )
plot ( cr )
title ( ‘ Plot of Cross correlation ‘ )
ylabel( ‘ Magnitude ‘ )
xlabel( ‘ Lag ‘)
ar = xcorr(x)
plot ( ar )

RESULT: - Convolution and Correlation plots were observed and plotted.