Reply by micdahl May 7, 20072007-05-07
>"micdahl" <micdahl@u.washington.edu> writes: >> [...] >> So now I am thoroughly confused as to which equation is correct. I >> understand the origin of the (IQ'-QI')/I^2 equation but don't know
where
>> the (IQ'-QI')/(I^2+Q^2) equation stems from. This is the one everyone >> seems to quote however. If either of you could give a reason for >> championing the latter equation I would greatly appreciate it. > >We wish to determine dtheta(t)/dt, where theta(t) = arctan(Q(t)/I(t)). > >First, let w(t) = Q(t)/I(t). Then theta(t) = arctan(w(t)). >From the chain rule of the derivative, > > dtheta(t)/dt = dtheta(w)/dw * dw(t)/dt > >Now darctan(w(t))/dw = 1 / (1+w^2). So now we need dw(t)/dt. > >From the quotient rule, > > dw(t)/dt = d(Q(t)/I(t))/dt > = Q'(t)I(t) - Q(t)I'(T) / I^2(t) > >I think you can finish it from here. >-- >% Randy Yates % "I met someone who looks alot like
you,
>%% Fuquay-Varina, NC % she does the things you do,
>%%% 919-577-9882 % but she is an
IBM."
>%%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO
>http://home.earthlink.net/~yatescr >
Beautiful!! So we are not approximating arctan(Q/I) as (Q/I) at all but carrying out the derivative analytically. I guess I got caught up in the approximation red herring. Thank you both for your help! -Michael _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
Reply by Randy Yates May 7, 20072007-05-07
"micdahl" <micdahl@u.washington.edu> writes:
> [...] > So now I am thoroughly confused as to which equation is correct. I > understand the origin of the (IQ'-QI')/I^2 equation but don't know where > the (IQ'-QI')/(I^2+Q^2) equation stems from. This is the one everyone > seems to quote however. If either of you could give a reason for > championing the latter equation I would greatly appreciate it.
We wish to determine dtheta(t)/dt, where theta(t) = arctan(Q(t)/I(t)). First, let w(t) = Q(t)/I(t). Then theta(t) = arctan(w(t)). From the chain rule of the derivative, dtheta(t)/dt = dtheta(w)/dw * dw(t)/dt Now darctan(w(t))/dw = 1 / (1+w^2). So now we need dw(t)/dt. From the quotient rule, dw(t)/dt = d(Q(t)/I(t))/dt = Q'(t)I(t) - Q(t)I'(T) / I^2(t) I think you can finish it from here. -- % Randy Yates % "I met someone who looks alot like you, %% Fuquay-Varina, NC % she does the things you do, %%% 919-577-9882 % but she is an IBM." %%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO http://home.earthlink.net/~yatescr
Reply by Jerry Avins May 7, 20072007-05-07
micdahl wrote:

   ...

> So now I am thoroughly confused as to which equation is correct. I > understand the origin of the (IQ'-QI')/I^2 equation but don't know where > the (IQ'-QI')/(I^2+Q^2) equation stems from. This is the one everyone > seems to quote however. If either of you could give a reason for > championing the latter equation I would greatly appreciate it. > > Sorry for beating this dead horse....
(uv)' = (vu' - u v'_/v^2, as you note. We want d/dx[arctan)u/v)]. That turns out to be confusingly similar. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Reply by May 7, 20072007-05-07
On May 8, 6:25 am, "micdahl" <micd...@u.washington.edu> wrote:
> micdahl said: > > > > >> Well, I've found the answer to my question but then aquired another > >> question: > > >> There is a long thread discussing the math behind FM demodulation, and > I > >> think Jerry eloquently said: > > >> "Yes, you want arctan(Q/I), but you need to find Q/I first. If the > >>sample > > >> rate is high enough to keep Q/I < .1, the arctan may not be needed. > >> (Arctan(.1) = .0997)" > > >> This makes sense, though the equation that kept comming up was: > > >> (IQ'-QI')/(I^2+Q^2) = (Q/I)' > > >> Though this is not correct, the quotient rule should produce > > >> (IQ'-QI')/I^2 = (Q/I)' > > >> Yet there are many posts where people have advocated the former > >>equation > >> So, based on these findings, the correct equation in discrete form > >>should > >> look like: > > >> I(n-1)*[Q(n) - Q[(n-2)] - Q(n-1)*[I(n) - I(n-2)] > >> w(n-1)= ------------------------------------------------------ > >> I(n-1)*I(n-1) > > >> However I feel the derivative is better represented by > > >> I(n-1)*[Q(n) - Q[(n-2)]*(fs/2) - Q(n-1)*[I(n) - I(n-2)]*(fs/2) > >> w(n-1)= ------------------------------------------------------ > >> I(n-1)*I(n-1) > > Jerry Replied: > > > I(n-1)*[Q(n) - Q[(n-2)] - Q(n-1)*[I(n) - I(n-2)] > >= (fs/2)* -------------------------------------------------, > > I(n-1)*I(n-1) > > >Where fs/2 is a constant that you can lump in to the gain of the > >transducers etc. > > >Jerry > >-- > >Engineering is the art of making what you want from things you can get. > > So it seems Jerry agrees with the (Q/I)' approximation of (arctan(Q/I))' > that is expanded by the quotient rule. > > Then Randy said > > > On May 7, 5:26 pm, "micdahl" <micd...@u.washington.edu> wrote: > >> = I*dQ/dt - Q*dI/dt > > > don't forget to divide by sqrt(I^2+Q^2) > >It's "I^2+Q^2" - there is no square root. > >-- > >% Randy Yates % "Bird, on the wing, > > So Randy proposes the (IQ'-QI')/(I^2+Q^2) equation, which I don't > understand the etiology of. Then Jerry seems to agree with this > formulation after acknowledging the mistake of using a square root: > > >> I'm not sure you can avoid dividing by an approximation of > >> sqrt(I^2+Q^2) > >> -- max(I,Q)+ min(I,Q)/4 would do -- unless abrupt changes in amplitude > >> won't interfere with finding the vibration frequency(s). An FFT will > >> interpret amplitude effects as added frequencies. > > No square root! I keep falling into that one. Bah! (But there's no > > avoiding the division unless the reflected amplitude is fairly constant, > > only the phase being affected by vibration or zero crossings alone are > > all the data needed.) > > So now I am thoroughly confused as to which equation is correct. I > understand the origin of the (IQ'-QI')/I^2 equation but don't know where > the (IQ'-QI')/(I^2+Q^2) equation stems from. This is the one everyone > seems to quote however. If either of you could give a reason for > championing the latter equation I would greatly appreciate it. > > Sorry for beating this dead horse.... > > Michael > > _____________________________________ > Do you know a company who employs DSP engineers? > Is it already listed athttp://dsprelated.com/employers.php?
Oops thats right - no sqrt. If you diff arctan(f(x) you get 1/ (1+f(x)^2)X f'(x)
Reply by micdahl May 7, 20072007-05-07
micdahl said:
>> Well, I've found the answer to my question but then aquired another >> question: >> >> There is a long thread discussing the math behind FM demodulation, and
I
>> think Jerry eloquently said: >> >> "Yes, you want arctan(Q/I), but you need to find Q/I first. If the >>sample >> >> rate is high enough to keep Q/I < .1, the arctan may not be needed. >> (Arctan(.1) = .0997)" >> >> This makes sense, though the equation that kept comming up was: >> >> (IQ'-QI')/(I^2+Q^2) = (Q/I)' >> >> Though this is not correct, the quotient rule should produce >> >> (IQ'-QI')/I^2 = (Q/I)' >> >> Yet there are many posts where people have advocated the former >>equation
>> So, based on these findings, the correct equation in discrete form >>should >> look like: >> >> I(n-1)*[Q(n) - Q[(n-2)] - Q(n-1)*[I(n) - I(n-2)] >> w(n-1)= ------------------------------------------------------ >> I(n-1)*I(n-1) >> >> However I feel the derivative is better represented by >> >> I(n-1)*[Q(n) - Q[(n-2)]*(fs/2) - Q(n-1)*[I(n) - I(n-2)]*(fs/2) >> w(n-1)= ------------------------------------------------------ >> I(n-1)*I(n-1)
Jerry Replied:
> I(n-1)*[Q(n) - Q[(n-2)] - Q(n-1)*[I(n) - I(n-2)] >= (fs/2)* -------------------------------------------------, > I(n-1)*I(n-1) > >Where fs/2 is a constant that you can lump in to the gain of the >transducers etc. > >Jerry >-- >Engineering is the art of making what you want from things you can get.
So it seems Jerry agrees with the (Q/I)' approximation of (arctan(Q/I))' that is expanded by the quotient rule. Then Randy said
> On May 7, 5:26 pm, "micdahl" <micd...@u.washington.edu> wrote: >> = I*dQ/dt - Q*dI/dt >> > don't forget to divide by sqrt(I^2+Q^2)
>It's "I^2+Q^2" - there is no square root. >-- >% Randy Yates % "Bird, on the wing,
So Randy proposes the (IQ'-QI')/(I^2+Q^2) equation, which I don't understand the etiology of. Then Jerry seems to agree with this formulation after acknowledging the mistake of using a square root:
>> I'm not sure you can avoid dividing by an approximation of >> sqrt(I^2+Q^2) >> -- max(I,Q)+ min(I,Q)/4 would do -- unless abrupt changes in amplitude
>> won't interfere with finding the vibration frequency(s). An FFT will >> interpret amplitude effects as added frequencies.
> No square root! I keep falling into that one. Bah! (But there's no > avoiding the division unless the reflected amplitude is fairly constant,
> only the phase being affected by vibration or zero crossings alone are > all the data needed.)
So now I am thoroughly confused as to which equation is correct. I understand the origin of the (IQ'-QI')/I^2 equation but don't know where the (IQ'-QI')/(I^2+Q^2) equation stems from. This is the one everyone seems to quote however. If either of you could give a reason for championing the latter equation I would greatly appreciate it. Sorry for beating this dead horse.... Michael _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
Reply by Jerry Avins May 7, 20072007-05-07
Tim Wescott wrote:
> micdahl wrote: >>>>> How to interpret these signals in terms of your system depends on just >>>> how >>>>> your system is massaging things. If it is just sending out a ping and >>>>> giving you the nearly-raw demodulated result, then the phase of a >>>>> reflection will depend on the distance of the reflecting surface from >>>> the >>>>> transducer. If that surface is moving then the phase will rotate, so >>>> you >>>>> would essentially want to build a FM detector on your returns; then >>>>> the >> >>>>> output of the detector would be proportional to the velocity of the >>>>> reflecting surface. >>>>> >> >> *snip* >>>> You sort of lost me on the FM detector. I aquire the signal already >>>> split >>>> >>>> into separate I and Q data. Can I just assume the velocity is >>>> proportional >>>> >>>> to the angle change in the "phasor" the I/Q data make in the complex >>>> plane? >>>> >>>> (assuming that this angle represents the phase difference between the >>>> >>>> recieved signal the tranducer gets from the object and a reference >>>> signal, >>>> >>>> therefore denoting relative position). >>> Yes. If you think like a radio guy you'd do that by implementing an FM >>> detector -- we're talking about the same thing, just in a different >>> language. You may find useful information for your problem by looking >> up >>> I-Q FM demodulation. It sounds like you now have a sufficient grasp of >>> the issues, however. >> >>> Tim Wescott >>> Control systems and communications consulting >>> http://www.wescottdesign.com >>> >>> Need to learn how to apply control theory in your embedded system? >>> "Applied Control Theory for Embedded Systems" by Tim Wescott >>> Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html >>> >> >> Thanks for all the advice about FM demodulation, this problem now looks >> deceptivly easy. Judging on what i've read about FM demodulation, I just >> have to run a software loop with: >> >> =[arctan(Qn/In)-arctan(Qn-1/In-1)]/delta t >> or = I*dQ/dt - Q*dI/dt >> >> Which should give me the frequencies of my vibration, even if the >> amplitudes are not to scale. >> Unfortunatly when reading about FM demodulation I got confused about >> whether or not I needed to filter and/or decimate my data. If my sampling >> frequency of I and Q (1563hz) is just over double the highest >> frequency in >> my signal I care about (~700Hz) can I just call it a day and not worry >> about it? If it does produce noise, would it be in the 0-700Hz range that >> I care about? >> Thanks! >> >> _____________________________________ >> Do you know a company who employs DSP engineers? Is it already listed >> at http://dsprelated.com/employers.php ? > > You might like to filter your data to get rid of aliases, but the > sampling is happening "out there" so it's inaccessible. I.e. the > sampling is defined by the time that the pulse is generated; this means > that all information between the last pulse and the next is already lost > before you've even collected one byte of data from the next pulse. Thus, > there's no place to put a filter. > > So you'll have to live with the aliases and hope they don't bite you, or > connive to increase the machine's sampling rate.
Having both I and Q signals effectively doubles the sample rate. Sampling more than twice the highest frequency in the signal refers to the total number of samples in a given time. In this case, both I and Q. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Reply by Randy Yates May 7, 20072007-05-07
Jerry Avins <jya@ieee.org> writes:

> Jerry Avins wrote: >> micdahl wrote: >> ... >> >>> =[arctan(Qn/In)-arctan(Qn-1/In-1)]/delta t >>> or = I*dQ/dt - Q*dI/dt >>> >>> Which should give me the frequencies of my vibration, even if the >>> amplitudes are not to scale. >> ... >> I'm not sure you can avoid dividing by an approximation of >> sqrt(I^2+Q^2) -- max(I,Q)+ min(I,Q)/4 would do -- unless abrupt >> changes in amplitude won't interfere with finding the vibration >> frequency(s). An FFT will interpret amplitude effects as added >> frequencies. > > No square root! I keep falling into that one. Bah! (But there's no > avoiding the division unless the reflected amplitude is fairly > constant, only the phase being affected by vibration or zero crossings > alone are all the data needed.)
Right! You've also correctly addressed the delay issue. -- % Randy Yates % "And all that I can do %% Fuquay-Varina, NC % is say I'm sorry, %%% 919-577-9882 % that's the way it goes..." %%%% <yates@ieee.org> % Getting To The Point', *Balance of Power*, ELO http://home.earthlink.net/~yatescr
Reply by Tim Wescott May 7, 20072007-05-07
micdahl wrote:
>>>> How to interpret these signals in terms of your system depends on just >>> how >>>> your system is massaging things. If it is just sending out a ping and >>>> giving you the nearly-raw demodulated result, then the phase of a >>>> reflection will depend on the distance of the reflecting surface from >>> the >>>> transducer. If that surface is moving then the phase will rotate, so >>> you >>>> would essentially want to build a FM detector on your returns; then the > >>>> output of the detector would be proportional to the velocity of the >>>> reflecting surface. >>>> > > *snip* >>> You sort of lost me on the FM detector. I aquire the signal already >>> split >>> >>> into separate I and Q data. Can I just assume the velocity is >>> proportional >>> >>> to the angle change in the "phasor" the I/Q data make in the complex >>> plane? >>> >>> (assuming that this angle represents the phase difference between the >>> >>> recieved signal the tranducer gets from the object and a reference >>> signal, >>> >>> therefore denoting relative position). >> Yes. If you think like a radio guy you'd do that by implementing an FM >> detector -- we're talking about the same thing, just in a different >> language. You may find useful information for your problem by looking > up >> I-Q FM demodulation. It sounds like you now have a sufficient grasp of >> the issues, however. > >> Tim Wescott >> Control systems and communications consulting >> http://www.wescottdesign.com >> >> Need to learn how to apply control theory in your embedded system? >> "Applied Control Theory for Embedded Systems" by Tim Wescott >> Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html >> > > Thanks for all the advice about FM demodulation, this problem now looks > deceptivly easy. Judging on what i've read about FM demodulation, I just > have to run a software loop with: > > =[arctan(Qn/In)-arctan(Qn-1/In-1)]/delta t > or > = I*dQ/dt - Q*dI/dt > > Which should give me the frequencies of my vibration, even if the > amplitudes are not to scale. > > Unfortunatly when reading about FM demodulation I got confused about > whether or not I needed to filter and/or decimate my data. If my sampling > frequency of I and Q (1563hz) is just over double the highest frequency in > my signal I care about (~700Hz) can I just call it a day and not worry > about it? If it does produce noise, would it be in the 0-700Hz range that > I care about? > > Thanks! > > _____________________________________ > Do you know a company who employs DSP engineers? > Is it already listed at http://dsprelated.com/employers.php ?
You might like to filter your data to get rid of aliases, but the sampling is happening "out there" so it's inaccessible. I.e. the sampling is defined by the time that the pulse is generated; this means that all information between the last pulse and the next is already lost before you've even collected one byte of data from the next pulse. Thus, there's no place to put a filter. So you'll have to live with the aliases and hope they don't bite you, or connive to increase the machine's sampling rate. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by Jerry Avins May 7, 20072007-05-07
Jerry Avins wrote:
> micdahl wrote: > > ... > >> =[arctan(Qn/In)-arctan(Qn-1/In-1)]/delta t >> or = I*dQ/dt - Q*dI/dt >> >> Which should give me the frequencies of my vibration, even if the >> amplitudes are not to scale. > > ... > > I'm not sure you can avoid dividing by an approximation of sqrt(I^2+Q^2) > -- max(I,Q)+ min(I,Q)/4 would do -- unless abrupt changes in amplitude > won't interfere with finding the vibration frequency(s). An FFT will > interpret amplitude effects as added frequencies.
No square root! I keep falling into that one. Bah! (But there's no avoiding the division unless the reflected amplitude is fairly constant, only the phase being affected by vibration or zero crossings alone are all the data needed.)
> Differentiating I and Q delays them. Be sure that the undifferentiated > quantities are delayed an equal time. A differentiating filter [-1,0,+1] > only works reasonably well below Fs/6 or so, but IIRC, that's OK for > you. Get the undifferentiated sample from the middle tap of the filter's > delay line and everything will be lined up in time.
Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Reply by Jerry Avins May 7, 20072007-05-07
micdahl wrote:

   ...

>> I've found the following equation in another thread (posted by Jerry): >> >> I(n-1)*[Q(n) - Q[(n-2)] + Q(n-1)*[I(n) - I(n-2)] >> w(n-1)= ------------------------------------------------------ >> I(n-1)*I(n-1) + Q(n-1)*Q(n-1) >> >> This one uses just I^2 + Q^2 in the denominator instead of sqrt(I^2 + >> Q^2). Is this the same equation? (obviously this equation is in the form >> of discrete points and makes sure that the derivative is at the same > time >> point as the I/Q.) Isn't the division by sqrt(I^2 + Q^2) a normalization >> procedure?
Do you mean me? I don't remember. I didn't know I could write things like that :-) .
>> Also, shouldn't dI/dt = [I(n)-I(n-2)]/dt where dt = 2/fs in this case?
Symmetry here allows us to ignore those scale factors. Dimensional analysis mourns the t in dt.
> > Well, I've found the answer to my question but then aquired another > question: > > There is a long thread discussing the math behind FM demodulation, and I > think Jerry eloquently said: > > "Yes, you want arctan(Q/I), but you need to find Q/I first. If the sample > > rate is high enough to keep Q/I < .1, the arctan may not be needed. > (Arctan(.1) = .0997)" > > This makes sense, though the equation that kept comming up was: > > (IQ'-QI')/(I^2+Q^2) = (Q/I)' > > Though this is not correct, the quotient rule should produce > > (IQ'-QI')/I^2 = (Q/I)' > > Yet there are many posts where people have advocated the former equation.
Never overlook the possibility of collective error. It has happened before. I need to think harder than I have time to right now.
> So, based on these findings, the correct equation in discrete form should > look like: > > I(n-1)*[Q(n) - Q[(n-2)] - Q(n-1)*[I(n) - I(n-2)] > w(n-1)= ------------------------------------------------------ > I(n-1)*I(n-1) > > However I feel the derivative is better represented by > > I(n-1)*[Q(n) - Q[(n-2)]*(fs/2) - Q(n-1)*[I(n) - I(n-2)]*(fs/2) > w(n-1)= ------------------------------------------------------ > I(n-1)*I(n-1)
I(n-1)*[Q(n) - Q[(n-2)] - Q(n-1)*[I(n) - I(n-2)] = (fs/2)* -------------------------------------------------, I(n-1)*I(n-1) Where fs/2 is a constant that you can lump in to the gain of the transducers etc. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;