On 11/18/2010 01:32 AM, cpshah99 wrote:>> On Nov 18, 10:01=A0am, "cpshah99"<cpshah99@n_o_s_p_a_m.rediffmail.com> >> wrote: >>> Hi Guys >>> >>> I am trying to get phase information of the incoming sine wave. I know > th= >> e >>> frequency of the signal. >>> >>> So I thought to perform fft, find peak at the frequency and measure the >>> phase by using arctan. But I get different ans. >>> >>> Then I tried another method in that, you multiply your incoming signal > wi= >> th >>> sine and cosine waves, accumulate the result and then perform arctan. > Wit= >> h >>> this method, I get exact result. >>> >>> So what is wrong with the fft method. >> >> It can't be used for this purpose. The difference between >> the two methods is that with the FFT, you estimate the >> phase at the frequencies implicitly determined by the FFT. >> In your particular case, none of these frequencies match >> up with the design frequency fc. >> >> In the 'accumulate' method you already know, and thus >> explicitly choose to use, the 'true' frequency. >> >> Rune >> > > Thanks Rune. > > So what would you do to estimate the phase of incoming signal in practical > receivers? > > And it is still not clear to me why fft method cant work?_An_ FFT method could work just fine, if your chosen frequency were dead on in one of the bins. The problem is that if the signal is not centered on a bin, then the relationship between the signal's 'real' phase and the phase you read out of the 'best matching' bin isn't a direct one. All the information you need is in the FFT -- it's a lossless transform -- but your "find the biggest bin and extract phase" is far too simple. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →
Phase of sine wave using fft
Started by ●November 18, 2010
Reply by ●November 18, 20102010-11-18
Reply by ●November 18, 20102010-11-18
On 11/18/2010 01:54 AM, cpshah99 wrote:>>> >>> So what would you do to estimate the phase of incoming signal in > practica= >> l >>> receivers? >> >> I wouldn't. There is no need to. And unless one comes up >> with a universal time reference (which is hard), it is >> almost impossible for others to agree with the result. >> >>> And it is still not clear to me why fft method cant work? >> >> It's not that it can not work - occasionally it can - but that >> most of the time it doesn't. >> >> Rune >> > > OK. > > The reason to ask this que is that I am working on DoA problem. > > I was looking at TDOA method to locate the target. So for a given geometry, > for example 4 sensors placed on a square geometry and one sensor placed in > center, I can estimate the delay/distance using autocorrelation. And then > apply trigonometry to get elevation angle. > > But how do I find azimuth angle?Using trig. (And yes, the difficulty to do vs. difficulty to say ratio is very high). If you set up your trig problem in three dimensions I think you'll find that you can, indeed, solve for both elevation and azimuth. I think you'll also find that for many (and perhaps any) given set of delays at the antennas you'll have multiple solutions (this is an antenna sidelobe problem) -- so you'll need to decide which solutions you'll want to believe. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●November 18, 20102010-11-18
On Nov 18, 1:01�am, "cpshah99" <cpshah99@n_o_s_p_a_m.rediffmail.com> wrote:> Hi Guys > > I am trying to get phase information of the incoming sine wave. I know the > frequency of the signal. > > So I thought to perform fft, find peak at the frequency and measure the > phase by using arctan. But I get different ans.You can use an FFT to estimate phase. But first you must re-reference the resulting phases to the center of the window, not to the edges, where the phase is usually discontinuous. You re-reference the phase to the center either by doing a FFT-shift of the time domain data (rotate by half the aperture), or by flipping the phase of every other bin of the FFT result by 180 degrees. Then you can interpolate as usual for bin and non-bin-centered frequencies from the FFT results. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html
Reply by ●November 18, 20102010-11-18
Tim Wescott wrote:> If you set up your trig problem in three dimensions I think you'll find > that you can, indeed, solve for both elevation and azimuth. I think > you'll also find that for many (and perhaps any) given set of delays at > the antennas you'll have multiple solutions (this is an antenna sidelobe > problem) -- so you'll need to decide which solutions you'll want to > believe.The highly scientific word is "spatial aliasing". VLV
Reply by ●November 18, 20102010-11-18
>Using trig. (And yes, the difficulty to do vs. difficulty to say ratio >is very high). > >If you set up your trig problem in three dimensions I think you'll find >that you can, indeed, solve for both elevation and azimuth. I think >you'll also find that for many (and perhaps any) given set of delays at >the antennas you'll have multiple solutions (this is an antenna sidelobe >problem) -- so you'll need to decide which solutions you'll want tobelieve.> >-- >Hi Everyone Thanks for your replies. As I said earlier, I will have to set up a trig problem, which I did for a square geometry plus one more sensor at the center (which is also a ref). ^ Y | | 4-------------3 | | | | | | | 5------|-------> X | | | | 1-------------2 Now, assuming that I know the distances from the target to sensors, i.e. D1,D2,D3,D4 and D5. The distance between sensors is d, distance between sensor 1 and 3 is x=sqrt(2)*d and the distance between center to other sensors is y=x/2; Since, sensor 5 is ref, the elevation angle can be written as beta=90-acos((D5^2+y^2-D3^2)/(2*y*D5)); Now, to get azimuth angle, we need to draw a perpendicular line to X-Y plane, get that point and measure the angle counter clockwise. Now, I can measure the distance that point as R=sin(beta)*D5. But still, I am not sure, how I can get azimuth angle. Once again, thanks very much. Best Regards Chintan
Reply by ●November 18, 20102010-11-18
Rune Allnor <allnor@tele.ntnu.no> wrote:> On Nov 18, 10:01�am, "cpshah99" <cpshah99@n_o_s_p_a_m.rediffmail.com>>> I am trying to get phase information of the incoming sine wave. I know the >> frequency of the signal.>> So I thought to perform fft, find peak at the frequency > and measure the phase by using arctan. But I get different ans.In the limit as the transform length goes to infinity, I believe that works. It works much less well for shorter transforms.>> Then I tried another method in that, you multiply your incoming >> signal with sine and cosine waves, accumulate the result and >> then perform arctan. With this method, I get exact result.But do you really know the exact frequency? That is rare in real systems, even with crystals which are never exactly the same. What is the actual source for the reference signal?>> So what is wrong with the fft method.> It can't be used for this purpose. The difference between > the two methods is that with the FFT, you estimate the > phase at the frequencies implicitly determined by the FFT. > In your particular case, none of these frequencies match > up with the design frequency fc.Theoretically, the information is still there, but much harder to get out. Choosing the largest gives you the result for the frequency in that bin, but that likely isn't the right one. You could probably do an interpolation between the higher bins, and that would likely get close. Consider that your reference might be half way between two transform frequencies, such that two had the same amplitude. Then, with the right interpolation, you should be able to get the right answer.> In the 'accumulate' method you already know, and thus > explicitly choose to use, the 'true' frequency.The only way I know to get the 'true' frequency is with a PLL, but then the phase should always come out zero. -- glen
Reply by ●November 18, 20102010-11-18
cpshah99 <cpshah99@n_o_s_p_a_m.rediffmail.com> wrote: (snip)> The reason to ask this que is that I am working on DoA problem.OK, that explains why the reference is at the same frequency. (Assuming no Doppler shift due to moving objects.)> I was looking at TDOA method to locate the target. So for a given geometry, > for example 4 sensors placed on a square geometry and one sensor placed in > center, I can estimate the delay/distance using autocorrelation. And then > apply trigonometry to get elevation angle.As far as I know, the usual way, commonly used by the lock-in amplifier, is to use a mixer, extract the I and Q signals, (in-phase and quadrature), and then arctan. I think that is pretty much what you said, though it is usual to put low-pass filters on the mixer outputs.> But how do I find azimuth angle?-- glen
Reply by ●November 19, 20102010-11-19
On Nov 18, 6:35�pm, Tim Wescott <t...@seemywebsite.com> wrote:> On 11/18/2010 01:42 AM, Rune Allnor wrote: > > > > > > > On Nov 18, 10:32 am, "cpshah99"<cpshah99@n_o_s_p_a_m.rediffmail.com> > > wrote: > >>> On Nov 18, 10:01=A0am, "cpshah99"<cpshah99@n_o_s_p_a_m.rediffmail.com> > >>> wrote: > >>>> Hi Guys > > >>>> I am trying to get phase information of the incoming sine wave. I know > >> th= > >>> e > >>>> frequency of the signal. > > >>>> So I thought to perform fft, find peak at the frequency and measure the > >>>> phase by using arctan. But I get different ans. > > >>>> Then I tried another method in that, you multiply your incoming signal > >> wi= > >>> th > >>>> sine and cosine waves, accumulate the result and then perform arctan. > >> Wit= > >>> h > >>>> this method, I get exact result. > > >>>> So what is wrong with the fft method. > > >>> It can't be used for this purpose. The difference between > >>> the two methods is that with the FFT, you estimate the > >>> phase at the frequencies implicitly determined by the FFT. > >>> In your particular case, none of these frequencies match > >>> up with the design frequency fc. > > >>> In the 'accumulate' method you already know, and thus > >>> explicitly choose to use, the 'true' frequency. > > >>> Rune > > >> Thanks Rune. > > >> So what would you do to estimate the phase of incoming signal in practical > >> receivers? > > > I wouldn't. There is no need to. And unless one comes up > > with a universal time reference (which is hard), it is > > almost impossible for others to agree with the result. > > But for coherent data reception you _do_ need to know the phase of the > incoming signal -- or at least you have to know it's phase relative to > your own internal time reference. �Otherwise you can't demodulate anything.Phase modulation is a different question alltogether: 1) The signal is designed to be demodulated when recieved with arbitrary absolute phase 2) The phase difference is measured between a reference somehow embedded in the signal, and the information carrying signal Rune
Reply by ●November 19, 20102010-11-19
OK Guys. As Tim had said, trig should give all the angles (azimuth and elevation). But as he had said, there will be many solutions. I had to work a little hard but finally managed to get all the angles but it is complex and difficult to select a solution. It also depends a lot on which sensor we select as ref and as Fred had said, element spacing also matters. But from this TDOA exercise, it seems that I am not suppose to measure phase or relative phase at sensors. The only information that I need is time of arrival which can be obtained using cross-correlation. Am I correct??? This thread has been very informative. Many thanks guys. Chintan
Reply by ●November 19, 20102010-11-19
On Nov 19, 11:46�am, "cpshah99" <cpshah99@n_o_s_p_a_m.rediffmail.com> wrote:> OK Guys. > > As Tim had said, trig should give all the angles (azimuth and elevation). > > But as he had said, there will be many solutions. I had to work a little > hard but finally managed to get all the angles but it is complex and > difficult to select a solution. It also depends a lot on which sensor we > select as ref and as Fred had said, element spacing also matters. > > But from this TDOA exercise, it seems that I am not suppose to measure > phase or relative phase at sensors.You need to select some direction as reference. The DoA of the signal will be measured as some phase relative to this reference. The problem with all DoA estimators lie in the mechanics of doing these calculations. The classic beamformers use steering vectors (not unlike the usual filters) to separate the signal into spatial bands, and use the relative magnitudes of these bands to determine the DoA. MUSIC decomposes the signal into a matrix representation and then uses a brute-force search over all angles to find the best matching direction(s), while ESPRIT exploits certain geometric invariants of the array to avoid the brute-force search and instead compute the DoAs in more direct ways.> The only information that I need is > time of arrival which can be obtained using cross-correlation. Am I > correct???Not quite. The ToA is known - you already have a time stamp relating the n'th snapshot of the array to some physical time t. The DoA is computed from the *spatial* cross correlation between the signals recorded at the individual sensors. Rune







