>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 usea>> >generalized cross correlator for that kind of problem. =A0It=3D92llwork>> >just fine whether your signal is wideband (noise like), narrowband >> >(sinusoid) or some combination of the two. =A0The filter function inthe>> >frequency domain takes the nature of the signal (and anyinterference)>> >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 notbe =>the>> >strongest peak in the output. >> >> >Since you=3D92re using too many points, your signals look likeimpulses =>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 carefullyexa=>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 outputto>> >represent your time delay when your input is somewhat or actually >> >sinusoidal is wrong. =A0VERY WRONG. =A0Almost everyone who=3D92s takena=> 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. =A0Thelocati=>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 shouldbe>> >positive, and two of them negative. =A0In fact, for any location offthe>> >x =3D3D 60 or y =3D3D 30 center lines, you should always have twopositi=>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 asb=>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=3D92reusi=>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 isright.>> Only the delay is a worry. >> >> I am trying generalized cross correlation as shown in one of thepapers>> 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 beinof>> 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 triedwith>> 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?