- 5th February 2008, 10:00 #1

- Join Date
- Jul 2007
- Location
- Iran
- Posts
- 35
- Helped
- 6 / 6
- Points
- 2,433
- Level
- 11

## Which Matlab function is for cross-correlating two signals?

in order to crosscrrolate two signals which of these two Matlab uctions are true? "xcorr" or "crosscorr"

- 5th February 2008, 10:00

- 6th February 2008, 02:29 #2

- Join Date
- Jun 2002
- Location
- India
- Posts
- 840
- Helped
- 41 / 41
- Points
- 5,050
- Level
- 16

## xcorr crosscorr

xcorr is only what I am aware of. There is no crosscorr in my version.

1 members found this post helpful.

- 6th February 2008, 02:29

- 7th February 2008, 12:42 #3

- Join Date
- Jul 2007
- Location
- Iran
- Posts
- 35
- Helped
- 6 / 6
- Points
- 2,433
- Level
- 11

## crosscorr matlab

brmadhukar thank you for your helpful guide. I have another problem too:

there is a linear microphone array like this: x1 x2 x3 x4 x5 x6 x7 x8

The speech signal has propogated 1m from the center of the array.

I have written this code in order to find the sample delays that each microphone recieves the speech signal.

first using "wavread" function the signals are read

mic1=wavread('s1');

mic2=wavread('s2');

mic3=wavread('s3');

mic4=wavread('s4');

mic5=wavread('s5');

mic6=wavread('s6');

mic7=wavread('s7');

mic8=wavread('s8');

Now crosscorellate the input signals with reference signal (mic4) and find the sample in which the maximum occures. The sample in which miximum occures is the sample delay

%%%%%%%Synchronyze all input signals%%%%%%%

% cross-correlate the input signals

C1=xcorr(mic4,mic1); % mic4 is reference signal and has no delays

C2=xcorr(mic4,mic2);

C3=xcorr(mic4,mic3);

C4=xcorr(mic4,mic4);

C5=xcorr(mic4,mic5);

C6=xcorr(mic4,mic6);

C7=xcorr(mic4,mic7);

C8=xcorr(mic4,mic8);

% find the sample in which cross-corelation reaches it's maximun

b=1;

for k=2:41

if C8(k,1) >= C8(b,1)

b=k;

else

b=b;

end

end

return

I run this code and for all C1,C2,...,C8 sample delay is equal to "1".

I don't know what is my mistake?!!!

LOOKING FORWARD TO HEAR FROM YOU ALL.

REGARDS