Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

cross correlation in matlab - problem

Status
Not open for further replies.

syrioosh

Newbie level 2
Joined
Mar 17, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Poland
Activity points
1,295
Hello
I m trying to estimate time delay between signals using cross correlations.
Unfortunately I ve encountered a few problems I m unable to handle.
Here is code what I ve done. According to article I ve read it is supposed to be working.
I m expecting at the last figure, one peak which should indicate a delay between signals x1, and xr, but there isnt any

I m not very familiar with all this sutff, so please be tolerant
I look forward to receiving any help.
Thank you in advance
Here s code
Code:
%Cross correlation
N = 256;
n = 0:N-1;
D= 32;
alpha = 0.7
wn = 1*randn(size(0:1:255))  %generating noise
x1 = 5*[ones(1,4),zeros(1,N-4)]; % source 1
xd = 5*[zeros(1,D),ones(1,4),zeros(1,N-D-4)]; % delayed source
xr = alpha*xd+wn;                               % recived source

Y = xcorr(xr,x1);
R = Y(1:N);
Rrx = fliplr(R);
% Plots
subplot(411)
plot(n,x1);
title('Clear signal');
xlabel('Time')'
ylabel('Amplitude');
grid;
subplot(412)
plot(n,xd);
title('Delayed signal');
xlabel('Time');
ylabel('Amplitude');
grid;
subplot(413)
plot(n,xr);
title('Recivied signal');
xlabel('time');
ylabel('Amplitude');
grid;
subplot(414);
plot(n,Rrx);
title('Autocorrelation');
xlabel('lags');
ylabel('Autocorrelation');
grid;
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top