Lab 4
Lab 4
x=ones(1,10);
n=0:9;
n1=0:18;
stem(n,x);
xlabel("sample index");
ylabel("x(n)")
acf=xcorr(x,x);
stem(n1,acf);
xlabel("sample index");
ylabel("acf(x)");
1
INFERENCE:
The auto correlated signal is a triangular function which increase and decreases as the cunction passes by it
Consider x(n) = white gaussian noise (zero mean, unit variance). Compute ACF of x(n), white noise.
N=5000;
n=0:N-1;
n1=0:2*(N-1);
x=randn(size(n));
stem(n,x);
xlabel("sample index");
ylabel("x(n)")
2
acf=xcorr(x,x);
stem(n1,acf);
xlabel("sample index");
ylabel("acf(x)");
3
There is zero variance and a pulse at origin.
Detect the presence of a known rectangular pulse burried in noise. Consider x=[1,1,.....1], N=10, x1 = [ x
zeros(1,100)], Y = randn(1,N+100). Correlate y(n) with X1 and plot it.
x=ones(1,10);
N=10;
n=0:N+100-1;
x1=[x zeros(1,100)];
stem(n,x1);
4
Y=randn(1,N+100);
stem(n,Y);
5
corr=xcorr(Y,x1);
stem/(corr);
The peak in the cross-correlation plot indicates the best alignment between the pulse and the noise signal. you
can observe how well the rectangular pulse is detected within the noisy signal. The height of the peak provides
a measure of similarity, while the position of the peak indicates where the pulse best fits within the noise.