Reply by maz_p5 September 15, 20082008-09-15
>On Sep 14, 6:54=A0am, "maz_p5" <maz...@hotmail.com> wrote: >> >You should definitely NOT be using so many points. >> >> >Your cross correlation results are incorrect because your input >> >signals exhibit some sinusoidal behavior. =A0Normally, you=3D92d use
a
>> >generalized cross correlator for that kind of problem. =A0It=3D92ll
work
>> >just fine whether your signal is wideband (noise like), narrowband >> >(sinusoid) or some combination of the two. =A0The filter function in
the
>> >frequency domain takes the nature of the signal (and any
interference)
>> >into account such that the correlator output will be a very sharp >> >spike at the correct time delay. >> >> >However, when using a simple cross correlator with sinusoid-like >> >inputs, the output will also look sinusoidal - there are multiple >> >peaks. =A0You can still pick out the time delay by selecting the peak >> >closest to the zero time delay point (and with two N point inputs, >> >that point is at N when using MATLAB=3D92s xcorr). =A0And it may not
be =
>the
>> >strongest peak in the output. >> >> >Since you=3D92re using too many points, your signals look like
impulses =
>in >> >the time domain. =A0When those signals are transformed into the >> >frequency domain, they look like constants. =A0After the conjugation/ >> >multiply/inverse, the result also looks like an impulse. =A0But it >> >probably isn=3D92t - it just seems that way. =A0You should carefully
exa=
>mine >> >the output within about +/- 200 points around the N point to see if >> >there are multiple peaks, and PICK THE ONE NEAREST TO POINT N TO >> >REPRESENT YOUR TIME DELAY. =A0Picking the highest point in the output
to
>> >represent your time delay when your input is somewhat or actually >> >sinusoidal is wrong. =A0VERY WRONG. =A0Almost everyone who=3D92s taken
a=
> basic >> >signal processing course will be familiar with what happens to the >> >output of a simple cross correlator when the input is sinusoidal, >> >because they=3D92d have programmed it and seen it for themselves (you >> >should do that, too). >> >> >You should start off by using the minimum number of points needed. >> >That number should be just enough to adequately represent the signals >> >plus some extra zero padded points so as to avoid doing a circular >> >cross correlation. =A0And I wouldn=3D92t depend on using the
=3D91zero=
>=3D92 or >> >=3D91nearly zero=3D92 portion of your recorded data to zero pad.
=A0Ther=
>e may >> be >> >some correlated noise or start up transients in it. >> >> >And, before writing this, I took a few moments to look again at your >> >pre-computed time delays. =A0There=3D92s an OBVIOUS error. =A0The
locati=
>on >> >30,20 lies in the lower left quarter of your problem space, so >> >considering just delay12, 23, 34 and 14, two of those delays should
be
>> >positive, and two of them negative. =A0In fact, for any location off
the
>> >x =3D3D 60 or y =3D3D 30 center lines, you should always have two
positi=
>ve >> >delays and two negative delays. =A0So if delay12 is considered to be >> >positive, then delay34 should be negative. =A0Same with delay23(+) >> >versus delay14(-). =A0Just think of the two xcorr=3D92d microphones as
b=
>eing >> >on the left and right sides of an x axis. =A0A delay less than N is >> >negative (more to the left side), and a delay more than N is positive >> >(more to the right side). =A0For any location off the center lines of >> >your x,y grid, you should ALWAYS have 2 positive and 2 negative >> >delays. >> >> >So something is definitely not right, and I can hardly believe that >> >your =3D91formula=3D92 could be working correctly because you=3D92re
usi=
>ng >> >incorrect inputs to get a =3D92correct=3D92 result. >> >> >Also note that, based on your arrangement, points (60, anything) or >> >(anything, 30) should be zero time delay12, 23, 34 and 14. >> >> Hi, >> Yes i checked the mathematical calculation part of it and that is
right.
>> Only the delay is a worry. >> >> I am trying generalized cross correlation as shown in one of the
papers
>> and it says: >> >> Rm1m2=3D m1(f).conj(m2(f)) >> >> I am not getting this right because: >> n1=3Dfft(m1); >> n2=3Dfft(m2); >> c2=3Dconj(n2); >> >> now when i do n1*c2, it is not possible because both the matrices bein
of
>> same order that nx1. if i take the transpose of c2 and then apply or >> transpose of n1, i get out of memory error in matlab. I even tried
with
>> smaller data files and i still get this error. >> how do i solve this? >> Is this the right way?- Hide quoted text - >> >> - Show quoted text - > >You can't solve the simpler case, so now you're going to try to solve >the far more difficult one? Count me out. I am not about to conduct >a graduate level course one post at a time, especially when the person >trying to learn it is a beginner to DSP and programming. > >You unquestionably need to take some courses on DSP and programming. >Your last post makes that abundantly clear. You take an N point fft >of signal 1, an N point fft of signal 2, conjugate the latter, then >multiply the two N point sequences point by point. No matrices, no >transposition. It's a trivial programming problem, and a not so >trivial problem of trying to understand what your result really means. > >So take my suggestion very seriously - take some courses on DSP and >programming. If none are available to you at the present time, then, >at the very least, you should visit DSP web sites like deprelated.com >or one of the many others that deal with DSP and programming, and read >as much of the introductory material as possible. > >I hope I'm not coming across as too harsh (I certainly don't mean to), >but you really need to understand some basics a lot better. >
Hi, Thanks for the suggestion and now i am not taking it wrong. Yes, i agree i am not that good at matlab programming but at the moment, getting this done is my main priority. Its just that because im so tensed about this that im not givin time to think n understand. Neways, i got that thing working. as i said, just because im tensed, im making silly mistakes. But still, im not gettin right results with GCC. Any suggestions?
Reply by September 15, 20082008-09-15
On Sep 14, 6:54&#2013266080;am, "maz_p5" <maz...@hotmail.com> wrote:
> >You should definitely NOT be using so many points. > > >Your cross correlation results are incorrect because your input > >signals exhibit some sinusoidal behavior. &#2013266080;Normally, you=92d use a > >generalized cross correlator for that kind of problem. &#2013266080;It=92ll work > >just fine whether your signal is wideband (noise like), narrowband > >(sinusoid) or some combination of the two. &#2013266080;The filter function in the > >frequency domain takes the nature of the signal (and any interference) > >into account such that the correlator output will be a very sharp > >spike at the correct time delay. > > >However, when using a simple cross correlator with sinusoid-like > >inputs, the output will also look sinusoidal - there are multiple > >peaks. &#2013266080;You can still pick out the time delay by selecting the peak > >closest to the zero time delay point (and with two N point inputs, > >that point is at N when using MATLAB=92s xcorr). &#2013266080;And it may not be the > >strongest peak in the output. > > >Since you=92re using too many points, your signals look like impulses in > >the time domain. &#2013266080;When those signals are transformed into the > >frequency domain, they look like constants. &#2013266080;After the conjugation/ > >multiply/inverse, the result also looks like an impulse. &#2013266080;But it > >probably isn=92t - it just seems that way. &#2013266080;You should carefully examine > >the output within about +/- 200 points around the N point to see if > >there are multiple peaks, and PICK THE ONE NEAREST TO POINT N TO > >REPRESENT YOUR TIME DELAY. &#2013266080;Picking the highest point in the output to > >represent your time delay when your input is somewhat or actually > >sinusoidal is wrong. &#2013266080;VERY WRONG. &#2013266080;Almost everyone who=92s taken a basic > >signal processing course will be familiar with what happens to the > >output of a simple cross correlator when the input is sinusoidal, > >because they=92d have programmed it and seen it for themselves (you > >should do that, too). > > >You should start off by using the minimum number of points needed. > >That number should be just enough to adequately represent the signals > >plus some extra zero padded points so as to avoid doing a circular > >cross correlation. &#2013266080;And I wouldn=92t depend on using the =91zero=92 or > >=91nearly zero=92 portion of your recorded data to zero pad. &#2013266080;There may > be > >some correlated noise or start up transients in it. > > >And, before writing this, I took a few moments to look again at your > >pre-computed time delays. &#2013266080;There=92s an OBVIOUS error. &#2013266080;The location > >30,20 lies in the lower left quarter of your problem space, so > >considering just delay12, 23, 34 and 14, two of those delays should be > >positive, and two of them negative. &#2013266080;In fact, for any location off the > >x =3D 60 or y =3D 30 center lines, you should always have two positive > >delays and two negative delays. &#2013266080;So if delay12 is considered to be > >positive, then delay34 should be negative. &#2013266080;Same with delay23(+) > >versus delay14(-). &#2013266080;Just think of the two xcorr=92d microphones as being > >on the left and right sides of an x axis. &#2013266080;A delay less than N is > >negative (more to the left side), and a delay more than N is positive > >(more to the right side). &#2013266080;For any location off the center lines of > >your x,y grid, you should ALWAYS have 2 positive and 2 negative > >delays. > > >So something is definitely not right, and I can hardly believe that > >your =91formula=92 could be working correctly because you=92re using > >incorrect inputs to get a =92correct=92 result. > > >Also note that, based on your arrangement, points (60, anything) or > >(anything, 30) should be zero time delay12, 23, 34 and 14. > > Hi, > Yes i checked the mathematical calculation part of it and that is right. > Only the delay is a worry. > > I am trying generalized cross correlation as shown in one of the papers > and it says: > > Rm1m2= m1(f).conj(m2(f)) > > I am not getting this right because: > n1=fft(m1); > n2=fft(m2); > c2=conj(n2); > > now when i do n1*c2, it is not possible because both the matrices bein of > same order that nx1. if i take the transpose of c2 and then apply or > transpose of n1, i get out of memory error in matlab. I even tried with > smaller data files and i still get this error. > how do i solve this? > Is this the right way?- Hide quoted text - > > - Show quoted text -
You can't solve the simpler case, so now you're going to try to solve the far more difficult one? Count me out. I am not about to conduct a graduate level course one post at a time, especially when the person trying to learn it is a beginner to DSP and programming. You unquestionably need to take some courses on DSP and programming. Your last post makes that abundantly clear. You take an N point fft of signal 1, an N point fft of signal 2, conjugate the latter, then multiply the two N point sequences point by point. No matrices, no transposition. It's a trivial programming problem, and a not so trivial problem of trying to understand what your result really means. So take my suggestion very seriously - take some courses on DSP and programming. If none are available to you at the present time, then, at the very least, you should visit DSP web sites like deprelated.com or one of the many others that deal with DSP and programming, and read as much of the introductory material as possible. I hope I'm not coming across as too harsh (I certainly don't mean to), but you really need to understand some basics a lot better.
Reply by maz_p5 September 14, 20082008-09-14
> >You should definitely NOT be using so many points. > >Your cross correlation results are incorrect because your input >signals exhibit some sinusoidal behavior. Normally, you=92d use a >generalized cross correlator for that kind of problem. It=92ll work >just fine whether your signal is wideband (noise like), narrowband >(sinusoid) or some combination of the two. The filter function in the >frequency domain takes the nature of the signal (and any interference) >into account such that the correlator output will be a very sharp >spike at the correct time delay. > >However, when using a simple cross correlator with sinusoid-like >inputs, the output will also look sinusoidal - there are multiple >peaks. You can still pick out the time delay by selecting the peak >closest to the zero time delay point (and with two N point inputs, >that point is at N when using MATLAB=92s xcorr). And it may not be the >strongest peak in the output. > >Since you=92re using too many points, your signals look like impulses in >the time domain. When those signals are transformed into the >frequency domain, they look like constants. After the conjugation/ >multiply/inverse, the result also looks like an impulse. But it >probably isn=92t - it just seems that way. You should carefully examine >the output within about +/- 200 points around the N point to see if >there are multiple peaks, and PICK THE ONE NEAREST TO POINT N TO >REPRESENT YOUR TIME DELAY. Picking the highest point in the output to >represent your time delay when your input is somewhat or actually >sinusoidal is wrong. VERY WRONG. Almost everyone who=92s taken a basic >signal processing course will be familiar with what happens to the >output of a simple cross correlator when the input is sinusoidal, >because they=92d have programmed it and seen it for themselves (you >should do that, too). > >You should start off by using the minimum number of points needed. >That number should be just enough to adequately represent the signals >plus some extra zero padded points so as to avoid doing a circular >cross correlation. And I wouldn=92t depend on using the =91zero=92 or >=91nearly zero=92 portion of your recorded data to zero pad. There may
be
>some correlated noise or start up transients in it. > >And, before writing this, I took a few moments to look again at your >pre-computed time delays. There=92s an OBVIOUS error. The location >30,20 lies in the lower left quarter of your problem space, so >considering just delay12, 23, 34 and 14, two of those delays should be >positive, and two of them negative. In fact, for any location off the >x =3D 60 or y =3D 30 center lines, you should always have two positive >delays and two negative delays. So if delay12 is considered to be >positive, then delay34 should be negative. Same with delay23(+) >versus delay14(-). Just think of the two xcorr=92d microphones as being >on the left and right sides of an x axis. A delay less than N is >negative (more to the left side), and a delay more than N is positive >(more to the right side). For any location off the center lines of >your x,y grid, you should ALWAYS have 2 positive and 2 negative >delays. > >So something is definitely not right, and I can hardly believe that >your =91formula=92 could be working correctly because you=92re using >incorrect inputs to get a =92correct=92 result. > >Also note that, based on your arrangement, points (60, anything) or >(anything, 30) should be zero time delay12, 23, 34 and 14. >
Hi, Yes i checked the mathematical calculation part of it and that is right. Only the delay is a worry. I am trying generalized cross correlation as shown in one of the papers and it says: Rm1m2= m1(f).conj(m2(f)) I am not getting this right because: n1=fft(m1); n2=fft(m2); c2=conj(n2); now when i do n1*c2, it is not possible because both the matrices bein of same order that nx1. if i take the transpose of c2 and then apply or transpose of n1, i get out of memory error in matlab. I even tried with smaller data files and i still get this error. how do i solve this? Is this the right way?
Reply by maz_p5 September 14, 20082008-09-14
> >You should definitely NOT be using so many points. > >Your cross correlation results are incorrect because your input >signals exhibit some sinusoidal behavior. Normally, you=92d use a >generalized cross correlator for that kind of problem. It=92ll work >just fine whether your signal is wideband (noise like), narrowband >(sinusoid) or some combination of the two. The filter function in the >frequency domain takes the nature of the signal (and any interference) >into account such that the correlator output will be a very sharp >spike at the correct time delay. > >However, when using a simple cross correlator with sinusoid-like >inputs, the output will also look sinusoidal - there are multiple >peaks. You can still pick out the time delay by selecting the peak >closest to the zero time delay point (and with two N point inputs, >that point is at N when using MATLAB=92s xcorr). And it may not be the >strongest peak in the output. > >Since you=92re using too many points, your signals look like impulses in >the time domain. When those signals are transformed into the >frequency domain, they look like constants. After the conjugation/ >multiply/inverse, the result also looks like an impulse. But it >probably isn=92t - it just seems that way. You should carefully examine >the output within about +/- 200 points around the N point to see if >there are multiple peaks, and PICK THE ONE NEAREST TO POINT N TO >REPRESENT YOUR TIME DELAY. Picking the highest point in the output to >represent your time delay when your input is somewhat or actually >sinusoidal is wrong. VERY WRONG. Almost everyone who=92s taken a basic >signal processing course will be familiar with what happens to the >output of a simple cross correlator when the input is sinusoidal, >because they=92d have programmed it and seen it for themselves (you >should do that, too). > >You should start off by using the minimum number of points needed. >That number should be just enough to adequately represent the signals >plus some extra zero padded points so as to avoid doing a circular >cross correlation. And I wouldn=92t depend on using the =91zero=92 or >=91nearly zero=92 portion of your recorded data to zero pad. There may
be
>some correlated noise or start up transients in it. > >And, before writing this, I took a few moments to look again at your >pre-computed time delays. There=92s an OBVIOUS error. The location >30,20 lies in the lower left quarter of your problem space, so >considering just delay12, 23, 34 and 14, two of those delays should be >positive, and two of them negative. In fact, for any location off the >x =3D 60 or y =3D 30 center lines, you should always have two positive >delays and two negative delays. So if delay12 is considered to be >positive, then delay34 should be negative. Same with delay23(+) >versus delay14(-). Just think of the two xcorr=92d microphones as being >on the left and right sides of an x axis. A delay less than N is >negative (more to the left side), and a delay more than N is positive >(more to the right side). For any location off the center lines of >your x,y grid, you should ALWAYS have 2 positive and 2 negative >delays. > >So something is definitely not right, and I can hardly believe that >your =91formula=92 could be working correctly because you=92re using >incorrect inputs to get a =92correct=92 result. > >Also note that, based on your arrangement, points (60, anything) or >(anything, 30) should be zero time delay12, 23, 34 and 14. >
Hi, Yes i checked the mathematical calculation part of it and that is right. Only the delay is a worry. I am trying generalized cross correlation as shown in one of the papers and it says: Rm1m2= m1(f).conj(m2(f)) I am not getting this right because: n1=fft(m1); n2=fft(m2); c2=conj(n2); now when i do n1*c2, it is not possible because both the matrices bein of same order that nx1. if i take the transpose of c2 and then apply or transpose of n1, i get out of memory error in matlab. I even tried with smaller data files and i still get this error. how do i solve this? Is this the right way?
Reply by September 14, 20082008-09-14
You should definitely NOT be using so many points.

Your cross correlation results are incorrect because your input
signals exhibit some sinusoidal behavior.  Normally, you&#2013266066;d use a
generalized cross correlator for that kind of problem.  It&#2013266066;ll work
just fine whether your signal is wideband (noise like), narrowband
(sinusoid) or some combination of the two.  The filter function in the
frequency domain takes the nature of the signal (and any interference)
into account such that the correlator output will be a very sharp
spike at the correct time delay.

However, when using a simple cross correlator with sinusoid-like
inputs, the output will also look sinusoidal - there are multiple
peaks.  You can still pick out the time delay by selecting the peak
closest to the zero time delay point (and with two N point inputs,
that point is at N when using MATLAB&#2013266066;s xcorr).  And it may not be the
strongest peak in the output.

Since you&#2013266066;re using too many points, your signals look like impulses in
the time domain.  When those signals are transformed into the
frequency domain, they look like constants.  After the conjugation/
multiply/inverse, the result also looks like an impulse.  But it
probably isn&#2013266066;t - it just seems that way.  You should carefully examine
the output within about +/- 200 points around the N point to see if
there are multiple peaks, and PICK THE ONE NEAREST TO POINT N TO
REPRESENT YOUR TIME DELAY.  Picking the highest point in the output to
represent your time delay when your input is somewhat or actually
sinusoidal is wrong.  VERY WRONG.  Almost everyone who&#2013266066;s taken a basic
signal processing course will be familiar with what happens to the
output of a simple cross correlator when the input is sinusoidal,
because they&#2013266066;d have programmed it and seen it for themselves (you
should do that, too).

You should start off by using the minimum number of points needed.
That number should be just enough to adequately represent the signals
plus some extra zero padded points so as to avoid doing a circular
cross correlation.  And I wouldn&#2013266066;t depend on using the &#2013266065;zero&#2013266066; or
&#2013266065;nearly zero&#2013266066; portion of your recorded data to zero pad.  There may be
some correlated noise or start up transients in it.

And, before writing this, I took a few moments to look again at your
pre-computed time delays.  There&#2013266066;s an OBVIOUS error.  The location
30,20 lies in the lower left quarter of your problem space, so
considering just delay12, 23, 34 and 14, two of those delays should be
positive, and two of them negative.  In fact, for any location off the
x = 60 or y = 30 center lines, you should always have two positive
delays and two negative delays.  So if delay12 is considered to be
positive, then delay34 should be negative.  Same with delay23(+)
versus delay14(-).  Just think of the two xcorr&#2013266066;d microphones as being
on the left and right sides of an x axis.  A delay less than N is
negative (more to the left side), and a delay more than N is positive
(more to the right side).  For any location off the center lines of
your x,y grid, you should ALWAYS have 2 positive and 2 negative
delays.

So something is definitely not right, and I can hardly believe that
your &#2013266065;formula&#2013266066; could be working correctly because you&#2013266066;re using
incorrect inputs to get a &#2013266066;correct&#2013266066; result.

Also note that, based on your arrangement, points (60, anything) or
(anything, 30) should be zero time delay12, 23, 34 and 14.
Reply by maz_p5 September 13, 20082008-09-13
>On Sep 12, 10:47=A0am, "maz_p5" <maz...@hotmail.com> wrote: >> >>For one half of your problem, all you need to do is fill in a
look-up
>> >>table. =A0You pick a grid point x,y and determine the distance
between
>> >>that point and your microphones (simple high school geometry). Then >> >>you calculate the delay between that point and the microphones.
=A0As
>> >>per your example, for location (30,10), the time delay between that >> >>location and microphone 1 is .00093 sec. =A0You compute the delays
to
>> >>all the other microphones. =A0Then you should multiply the absolute >> >>delays by 44100 (the sample rate) to get the delay expressed in
terms
>> >>of the 'number of sample times.' =A0Those are the values you put
into
>> >>the look-up table (e.g.: for grid location 30,10 - the time delays
to
>> >>the microphones are: t1, t2, t3, t4). =A0I have no idea why you're >> >>computing distances after computing the time delays. >> >> >>Once you've populated the look-up table, you turn to the other half
of
>> >>your problem - computing the actual time delays using your >> >>measurements (do so with xcorr( ), max( ), or some other method to
be
>> >>determined later). =A0Your measured results will be a delay expressed
a=
>s >> >>'number of sample times.' =A0Now, using your measured results,
search
>> >>through the look-up table to find the best match between the
measured
>> >>and pre-computed time delays. >> >> >>Aa an aside, I also can't help but notice that you frequently start >> >>other threads under a different title for the same problem, and you >> >>ask for MATLAB code examples. =A0I strongly suspect that you are not >> >>very experienced with programming. =A0Most people posting here,
while
>> >>they can be very generous with their time and knowledge, won't do >> >>something like "Here's how to solve your problem analytically, and, >> >>oh, by the way, here's some MATLAB code to do it." =A0They
rightfully
>> >>expect that the person who poses the problem has some basic
analytical
>> >>and programming skills. =A0So I think you might have to reconsider
your
>> >>deadline and include some unscheduled 'learn how to program in
MATLAB'
>> >>time (or C, C++, FORTRAN, etc.). >> >> >>It takes time to learn DSP techniques, and it can be very >> >>frustrating. =A0But you should at least have some kind of
programming
>> >>experience. >> >> >Hi, >> >> >Thanks for the help. Honestly, you are right. I know my basics and I >> know >> >my problem very well. I know how to build up this system and what all >> steps >> >and procedures to follow. I have also read lot about it from various >> >papers. But yes, I am just a little weak as far as MATLAB is
concerned.
>> I >> >know the steps to do like i have to calculate the delay, >> cross-correlation, >> >location estimation and I also have papers which explain in terms of >> >mathematical formulas but I dont know what do they mean in terms of >> Matlab >> >functions and hence I asked for help. I dont want people to solve my >> system >> >for me, but example codes will help me understand the particular
point
>> >better. >> >Sorry for the trouble. >> >Thank you. >> >- Maz >> >> Hi, >> >> Below are the values by calculation as well as by cross - correlation
for
>> the point (30,20): >> >> Delay (in samples) =A0 =A0Delay by manual calculation =A0 Delay by
xcorr
>> >> Delay12 =A0 =A0 =A0 =A0 =A0 =A0 =A0 18.1251 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
>=A0 =A0 =A0 =A0 17 >> Delay13 =A0 =A0 =A0 =A0 =A0 =A0 =A0 80.998 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
>=A0 =A0 =A0 =A0 =A094 >> Delay14 =A0 =A0 =A0 =A0 =A0 =A0 =A0 72.8532 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
>=A0 =A0 =A0 =A0 76 >> Delay23 =A0 =A0 =A0 =A0 =A0 =A0 =A0 62.87337 =A0 =A0 =A0 =A0 =A0 =A0
=A0 =
>=A0 =A0 =A0 =A0250 >> Delay24 =A0 =A0 =A0 =A0 =A0 =A0 =A0 54.7281 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=
>=A0 =A0 =A0 =A0 54 >> Delay34 =A0 =A0 =A0 =A0 =A0 =A0 =A0 -8.14527 =A0 =A0 =A0 =A0 =A0 =A0
=A0 =
>=A0 =A0 =A0 -17 >> >> Now inserting the calculated values in my formula gives me the location
a=
>s >> (29.99,19.98) which is perfect; >> But, the cross-correlated values gives me the answer as (1.9869,33.2) >> which is not right. >> >> The cross - correlated values give perfect final answer for center >> location but not these ones on the side. >> >> This shows that my formula for calculating the location is correct,
but
>> somehow the 1st part i.e. calculating the exact delay is not right. >> >> Can you please help me with this? >> >> Thank you.- Hide quoted text - >> >> - Show quoted text - > > >Well, those xcorr results delay13, delay23 and delay34 seem way out of >range. The others aren't too bad, but I wouldn't trust them either. >One of the reasons I wanted you to pre-compute the entire grid was so >that you could see what kind of resolution you could expect from your >measured time delays (where the measured delays were from xcorr( ), >max( ) or some other method). > >The pre-computed delays should, of course, give you exact results. >When using xcorr, are you getting a broad peak with gently sloping >sides away from the peak, or multiple peaks, where each one is roughly >the same height as the others? The latter could happen if your input >signals to xcorr are sinusoidal. You mentioned before that your >inputs were mostly zero and then +/1 for a while, and then zero again. > >What exactly does your two time domain recordings look like? Are they >indeed sinusoids over a short period of time? And are they at a >particular frequency, or are they some combination of a few >frequencies? And how many points are you using for the xcorr - I hope >it=92s not the nearly one million points each like you were using
before.
>
Hi, Yes there are multiple peaks with the same frequency very close to each other near that sound arrival point. rest of the signal is flat close to zero. Also, iv noticed that the signals are not the same or delayed version of one another. obviously its coming from the same source but the signals are slight different, maybe due to many factors affecting it. This is the reason, I asked for your email so that i could email you one of sound sample sets for your to figure out what exactly it looks like. Then we can apply the same solution to all of them. can you please have a look. I think we can solve the solution much much quicker if you have a look at it. Also, yes the values i just showed in the last post were of the same huge data. But, I have calculated the readings for other points with shorter data of just 3 sec as well, and the answer still differs by huge sample points.
Reply by September 12, 20082008-09-12
On Sep 12, 10:47&#2013266080;am, "maz_p5" <maz...@hotmail.com> wrote:
> >>For one half of your problem, all you need to do is fill in a look-up > >>table. &#2013266080;You pick a grid point x,y and determine the distance between > >>that point and your microphones (simple high school geometry). Then > >>you calculate the delay between that point and the microphones. &#2013266080;As > >>per your example, for location (30,10), the time delay between that > >>location and microphone 1 is .00093 sec. &#2013266080;You compute the delays to > >>all the other microphones. &#2013266080;Then you should multiply the absolute > >>delays by 44100 (the sample rate) to get the delay expressed in terms > >>of the 'number of sample times.' &#2013266080;Those are the values you put into > >>the look-up table (e.g.: for grid location 30,10 - the time delays to > >>the microphones are: t1, t2, t3, t4). &#2013266080;I have no idea why you're > >>computing distances after computing the time delays. > > >>Once you've populated the look-up table, you turn to the other half of > >>your problem - computing the actual time delays using your > >>measurements (do so with xcorr( ), max( ), or some other method to be > >>determined later). &#2013266080;Your measured results will be a delay expressed as > >>'number of sample times.' &#2013266080;Now, using your measured results, search > >>through the look-up table to find the best match between the measured > >>and pre-computed time delays. > > >>Aa an aside, I also can't help but notice that you frequently start > >>other threads under a different title for the same problem, and you > >>ask for MATLAB code examples. &#2013266080;I strongly suspect that you are not > >>very experienced with programming. &#2013266080;Most people posting here, while > >>they can be very generous with their time and knowledge, won't do > >>something like "Here's how to solve your problem analytically, and, > >>oh, by the way, here's some MATLAB code to do it." &#2013266080;They rightfully > >>expect that the person who poses the problem has some basic analytical > >>and programming skills. &#2013266080;So I think you might have to reconsider your > >>deadline and include some unscheduled 'learn how to program in MATLAB' > >>time (or C, C++, FORTRAN, etc.). > > >>It takes time to learn DSP techniques, and it can be very > >>frustrating. &#2013266080;But you should at least have some kind of programming > >>experience. > > >Hi, > > >Thanks for the help. Honestly, you are right. I know my basics and I > know > >my problem very well. I know how to build up this system and what all > steps > >and procedures to follow. I have also read lot about it from various > >papers. But yes, I am just a little weak as far as MATLAB is concerned. > I > >know the steps to do like i have to calculate the delay, > cross-correlation, > >location estimation and I also have papers which explain in terms of > >mathematical formulas but I dont know what do they mean in terms of > Matlab > >functions and hence I asked for help. I dont want people to solve my > system > >for me, but example codes will help me understand the particular point > >better. > >Sorry for the trouble. > >Thank you. > >- Maz > > Hi, > > Below are the values by calculation as well as by cross - correlation for > the point (30,20): > > Delay (in samples) &#2013266080; &#2013266080;Delay by manual calculation &#2013266080; Delay by xcorr > > Delay12 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 18.1251 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 17 > Delay13 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 80.998 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;94 > Delay14 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 72.8532 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 76 > Delay23 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 62.87337 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;250 > Delay24 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 54.7281 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; 54 > Delay34 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; -8.14527 &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; -17 > > Now inserting the calculated values in my formula gives me the location as > (29.99,19.98) which is perfect; > But, the cross-correlated values gives me the answer as (1.9869,33.2) > which is not right. > > The cross - correlated values give perfect final answer for center > location but not these ones on the side. > > This shows that my formula for calculating the location is correct, but > somehow the 1st part i.e. calculating the exact delay is not right. > > Can you please help me with this? > > Thank you.- Hide quoted text - > > - Show quoted text -
Well, those xcorr results delay13, delay23 and delay34 seem way out of range. The others aren't too bad, but I wouldn't trust them either. One of the reasons I wanted you to pre-compute the entire grid was so that you could see what kind of resolution you could expect from your measured time delays (where the measured delays were from xcorr( ), max( ) or some other method). The pre-computed delays should, of course, give you exact results. When using xcorr, are you getting a broad peak with gently sloping sides away from the peak, or multiple peaks, where each one is roughly the same height as the others? The latter could happen if your input signals to xcorr are sinusoidal. You mentioned before that your inputs were mostly zero and then +/1 for a while, and then zero again. What exactly does your two time domain recordings look like? Are they indeed sinusoids over a short period of time? And are they at a particular frequency, or are they some combination of a few frequencies? And how many points are you using for the xcorr - I hope it&#2013266066;s not the nearly one million points each like you were using before.
Reply by maz_p5 September 12, 20082008-09-12
>>For one half of your problem, all you need to do is fill in a look-up >>table. You pick a grid point x,y and determine the distance between >>that point and your microphones (simple high school geometry). Then >>you calculate the delay between that point and the microphones. As >>per your example, for location (30,10), the time delay between that >>location and microphone 1 is .00093 sec. You compute the delays to >>all the other microphones. Then you should multiply the absolute >>delays by 44100 (the sample rate) to get the delay expressed in terms >>of the 'number of sample times.' Those are the values you put into >>the look-up table (e.g.: for grid location 30,10 - the time delays to >>the microphones are: t1, t2, t3, t4). I have no idea why you're >>computing distances after computing the time delays. >> >>Once you've populated the look-up table, you turn to the other half of >>your problem - computing the actual time delays using your >>measurements (do so with xcorr( ), max( ), or some other method to be >>determined later). Your measured results will be a delay expressed as >>'number of sample times.' Now, using your measured results, search >>through the look-up table to find the best match between the measured >>and pre-computed time delays. >> >>Aa an aside, I also can't help but notice that you frequently start >>other threads under a different title for the same problem, and you >>ask for MATLAB code examples. I strongly suspect that you are not >>very experienced with programming. Most people posting here, while >>they can be very generous with their time and knowledge, won't do >>something like "Here's how to solve your problem analytically, and, >>oh, by the way, here's some MATLAB code to do it." They rightfully >>expect that the person who poses the problem has some basic analytical >>and programming skills. So I think you might have to reconsider your >>deadline and include some unscheduled 'learn how to program in MATLAB' >>time (or C, C++, FORTRAN, etc.). >> >>It takes time to learn DSP techniques, and it can be very >>frustrating. But you should at least have some kind of programming >>experience. >> >Hi, > >Thanks for the help. Honestly, you are right. I know my basics and I
know
>my problem very well. I know how to build up this system and what all
steps
>and procedures to follow. I have also read lot about it from various >papers. But yes, I am just a little weak as far as MATLAB is concerned.
I
>know the steps to do like i have to calculate the delay,
cross-correlation,
>location estimation and I also have papers which explain in terms of >mathematical formulas but I dont know what do they mean in terms of
Matlab
>functions and hence I asked for help. I dont want people to solve my
system
>for me, but example codes will help me understand the particular point >better. >Sorry for the trouble. >Thank you. >- Maz
Hi, Below are the values by calculation as well as by cross - correlation for the point (30,20): Delay (in samples) Delay by manual calculation Delay by xcorr Delay12 18.1251 17 Delay13 80.998 94 Delay14 72.8532 76 Delay23 62.87337 250 Delay24 54.7281 54 Delay34 -8.14527 -17 Now inserting the calculated values in my formula gives me the location as (29.99,19.98) which is perfect; But, the cross-correlated values gives me the answer as (1.9869,33.2) which is not right. The cross - correlated values give perfect final answer for center location but not these ones on the side. This shows that my formula for calculating the location is correct, but somehow the 1st part i.e. calculating the exact delay is not right. Can you please help me with this? Thank you.
Reply by maz_p5 September 12, 20082008-09-12
>For one half of your problem, all you need to do is fill in a look-up >table. You pick a grid point x,y and determine the distance between >that point and your microphones (simple high school geometry). Then >you calculate the delay between that point and the microphones. As >per your example, for location (30,10), the time delay between that >location and microphone 1 is .00093 sec. You compute the delays to >all the other microphones. Then you should multiply the absolute >delays by 44100 (the sample rate) to get the delay expressed in terms >of the 'number of sample times.' Those are the values you put into >the look-up table (e.g.: for grid location 30,10 - the time delays to >the microphones are: t1, t2, t3, t4). I have no idea why you're >computing distances after computing the time delays. > >Once you've populated the look-up table, you turn to the other half of >your problem - computing the actual time delays using your >measurements (do so with xcorr( ), max( ), or some other method to be >determined later). Your measured results will be a delay expressed as >'number of sample times.' Now, using your measured results, search >through the look-up table to find the best match between the measured >and pre-computed time delays. > >Aa an aside, I also can't help but notice that you frequently start >other threads under a different title for the same problem, and you >ask for MATLAB code examples. I strongly suspect that you are not >very experienced with programming. Most people posting here, while >they can be very generous with their time and knowledge, won't do >something like "Here's how to solve your problem analytically, and, >oh, by the way, here's some MATLAB code to do it." They rightfully >expect that the person who poses the problem has some basic analytical >and programming skills. So I think you might have to reconsider your >deadline and include some unscheduled 'learn how to program in MATLAB' >time (or C, C++, FORTRAN, etc.). > >It takes time to learn DSP techniques, and it can be very >frustrating. But you should at least have some kind of programming >experience. >
Hi, Thanks for the help. Honestly, you are right. I know my basics and I know my problem very well. I know how to build up this system and what all steps and procedures to follow. I have also read lot about it from various papers. But yes, I am just a little weak as far as MATLAB is concerned. I know the steps to do like i have to calculate the delay, cross-correlation, location estimation and I also have papers which explain in terms of mathematical formulas but I dont know what do they mean in terms of Matlab functions and hence I asked for help. I dont want people to solve my system for me, but example codes will help me understand the particular point better. Sorry for the trouble. Thank you. - Maz
Reply by September 12, 20082008-09-12
For one half of your problem, all you need to do is fill in a look-up
table.  You pick a grid point x,y and determine the distance between
that point and your microphones (simple high school geometry). Then
you calculate the delay between that point and the microphones.  As
per your example, for location (30,10), the time delay between that
location and microphone 1 is .00093 sec.  You compute the delays to
all the other microphones.  Then you should multiply the absolute
delays by 44100 (the sample rate) to get the delay expressed in terms
of the 'number of sample times.'  Those are the values you put into
the look-up table (e.g.: for grid location 30,10 - the time delays to
the microphones are: t1, t2, t3, t4).  I have no idea why you're
computing distances after computing the time delays.

Once you've populated the look-up table, you turn to the other half of
your problem - computing the actual time delays using your
measurements (do so with xcorr( ), max( ), or some other method to be
determined later).  Your measured results will be a delay expressed as
'number of sample times.'  Now, using your measured results, search
through the look-up table to find the best match between the measured
and pre-computed time delays.

Aa an aside, I also can't help but notice that you frequently start
other threads under a different title for the same problem, and you
ask for MATLAB code examples.  I strongly suspect that you are not
very experienced with programming.  Most people posting here, while
they can be very generous with their time and knowledge, won't do
something like "Here's how to solve your problem analytically, and,
oh, by the way, here's some MATLAB code to do it."  They rightfully
expect that the person who poses the problem has some basic analytical
and programming skills.  So I think you might have to reconsider your
deadline and include some unscheduled 'learn how to program in MATLAB'
time (or C, C++, FORTRAN, etc.).

It takes time to learn DSP techniques, and it can be very
frustrating.  But you should at least have some kind of programming
experience.