DSPRelated.com
Forums

Converting I and Q to real signal

Started by micdahl May 6, 2007
Hello, 

I am a Mech Eng, so I'm not exactly a ninja at quadrature demodulation,
and I have a problem that i've been trying to figure out for a while. 

Some background on the system:
I am measuring vibrations using doppler ultrasound, vibrations induced by
an actuator at around 200 Hz. The Doppler ultrasound setup I have spits
out pulses of 5MHz at a frequency of 1563 pulses per sec. The machine
compares the phases of the pulses to a reference signal and gets velocity
information (using the doppler equation even though this isn't technically
doppler shifting, it's pulse echo discrimination)

Question:
I have the machine rigged so that I extract an I array and a Q array.
These arrays are 1 X 1024 and have a sampling frequency of the pulses
(1563 Hz). How do I convert these back into a velocity signal? All I want
is a real baseband signal representing the velocity of my object i'm
scanning. 

I guess I'm confused as to what the I and the Q represent physically. I've
been reading up on quadrature demodulation but everything i've read jumps
right to having an I and Q and doesn't explain what they represent
physically. My best guess is they are the real and imaginary components of
the impulse vectors from a signal in the complex frequency domain. Is there
any good scripts in MATLAB to covert the I/Q data back to a real signal? 

Lastly, I'm really only interested in the frequency spectrum of the
velocity signal. Is there a shortcut for getting this directly from the
I/Q data without coverting to a real baseband signal? 

Thanks in advance!

Michael




_____________________________________
Do you know a company who employs DSP engineers?  
Is it already listed at http://dsprelated.com/employers.php ?
On Sun, 06 May 2007 05:55:16 -0500, micdahl wrote:

> Hello, > > I am a Mech Eng, so I'm not exactly a ninja at quadrature demodulation, > > and I have a problem that i've been trying to figure out for a while. > > Some background on the system: > I am measuring vibrations using doppler ultrasound, vibrations induced by > > an actuator at around 200 Hz. The Doppler ultrasound setup I have spits > > out pulses of 5MHz at a frequency of 1563 pulses per sec. The machine > > compares the phases of the pulses to a reference signal and gets velocity > > information (using the doppler equation even though this isn't technically > > doppler shifting, it's pulse echo discrimination) > > Question: > I have the machine rigged so that I extract an I array and a Q array. > > These arrays are 1 X 1024 and have a sampling frequency of the pulses > > (1563 Hz). How do I convert these back into a velocity signal? All I want > > is a real baseband signal representing the velocity of my object i'm > > scanning. > > I guess I'm confused as to what the I and the Q represent physically. I've > > been reading up on quadrature demodulation but everything i've read jumps > > right to having an I and Q and doesn't explain what they represent > > physically. My best guess is they are the real and imaginary components of > > the impulse vectors from a signal in the complex frequency domain. Is there > > any good scripts in MATLAB to covert the I/Q data back to a real signal? > > Lastly, I'm really only interested in the frequency spectrum of the > > velocity signal. Is there a shortcut for getting this directly from the > > I/Q data without coverting to a real baseband signal? > > Thanks in advance! > > Michael > > > > > _____________________________________ > Do you know a company who employs DSP engineers? > Is it already listed at http://dsprelated.com/employers.php ?
Call me a bit too literal, but at rock bottom, the physical meaning of an I and Q signal pair has nothing to do with imaginary numbers. Why? Because imaginary numbers don't exist in real life. Physically, the I and Q channels are the result of multiplying the incoming signal by the carrier and by a signal that is offset 90 degrees in phase from the carrier, then averaging the two resulting signals. A signal that is purely in phase with the carrier will give an inphase result that is proportional to the signal amplitude and a quadrature result that is exactly zero. A signal that is offset by exactly 90 degrees from the carrier will give an inphase result of zero and a quadrature result that is proportional to the signal amplitude. A very convenient way of modeling this is to say that the inphase and quadrature pair form a complex number that can be interpreted in terms of magnitude and phase -- in that sense you are correct. 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. I have to say I'm surprised that this isn't a problem that's already been solved by your equipment supplier -- don't they have a velocity or distance readout already there for you? -- 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
>Call me a bit too literal, but at rock bottom, the physical meaning of an
I
>and Q signal pair has nothing to do with imaginary numbers. Why? >Because imaginary numbers don't exist in real life. > >Physically, the I and Q channels are the result of multiplying the >incoming signal by the carrier and by a signal that is offset 90 degrees >in phase from the carrier, then averaging the two resulting signals. >A signal that is purely in phase with the carrier will give an inphase >result that is proportional to the signal amplitude and a quadrature >result that is exactly zero. A signal that is offset by exactly 90 >degrees from the carrier will give an inphase result of zero and a >quadrature result that is proportional to the signal amplitude. > >A very convenient way of modeling this is to say that the inphase and >quadrature pair form a complex number that can be interpreted in terms
of
>magnitude and phase -- in that sense you are correct. > >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. > >I have to say I'm surprised that this isn't a problem that's already
been
>solved by your equipment supplier -- don't they have a velocity or >distance readout already there for you? > >-- >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 >
Wow, it makes a lot more sense if you think about it as just a sine and cosine multiplied by the original signal and then treat it sort of like a phasor. So it sounds like my velocity is related to the phase angle I and Q make in the complex plain. I assume that the magnitude of the IQ vector relates to the signal intensity. 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). The reason the equipment doesn't do all the work for me is because ultrasound machines usually pack everything up inside and output something thats dumbed down and easy for the sonographer to interpret. I'm also using the machine for a purpose it isn't intended for so I need access to the data stream at some point so I can get the origional signal before it has gone through special filters, ect. The best hack I could do was the raw IQ output. Your input has already enlightened me greatly, thank you for your help! Michael _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
On May 7, 6:41 am, Tim Wescott <t...@seemywebsite.com> wrote:
> On Sun, 06 May 2007 05:55:16 -0500, micdahl wrote: > > Hello, > > > I am a Mech Eng, so I'm not exactly a ninja at quadrature demodulation, > > > and I have a problem that i've been trying to figure out for a while. > > > Some background on the system: > > I am measuring vibrations using doppler ultrasound, vibrations induced by > > > an actuator at around 200 Hz. The Doppler ultrasound setup I have spits > > > out pulses of 5MHz at a frequency of 1563 pulses per sec. The machine > > > compares the phases of the pulses to a reference signal and gets velocity > > > information (using the doppler equation even though this isn't technically > > > doppler shifting, it's pulse echo discrimination) > > > Question: > > I have the machine rigged so that I extract an I array and a Q array. > > > These arrays are 1 X 1024 and have a sampling frequency of the pulses > > > (1563 Hz). How do I convert these back into a velocity signal? All I want > > > is a real baseband signal representing the velocity of my object i'm > > > scanning. > > > I guess I'm confused as to what the I and the Q represent physically. I've > > > been reading up on quadrature demodulation but everything i've read jumps > > > right to having an I and Q and doesn't explain what they represent > > > physically. My best guess is they are the real and imaginary components of > > > the impulse vectors from a signal in the complex frequency domain. Is there > > > any good scripts in MATLAB to covert the I/Q data back to a real signal? > > > Lastly, I'm really only interested in the frequency spectrum of the > > > velocity signal. Is there a shortcut for getting this directly from the > > > I/Q data without coverting to a real baseband signal? > > > Thanks in advance! > > > Michael > > > _____________________________________ > > Do you know a company who employs DSP engineers? > > Is it already listed athttp://dsprelated.com/employers.php? > > Call me a bit too literal, but at rock bottom, the physical meaning of an I > and Q signal pair has nothing to do with imaginary numbers. Why? > Because imaginary numbers don't exist in real life. > > Physically, the I and Q channels are the result of multiplying the > incoming signal by the carrier and by a signal that is offset 90 degrees > in phase from the carrier, then averaging the two resulting signals. > A signal that is purely in phase with the carrier will give an inphase > result that is proportional to the signal amplitude and a quadrature > result that is exactly zero. A signal that is offset by exactly 90 > degrees from the carrier will give an inphase result of zero and a > quadrature result that is proportional to the signal amplitude. > > A very convenient way of modeling this is to say that the inphase and > quadrature pair form a complex number that can be interpreted in terms of > magnitude and phase -- in that sense you are correct. > > 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. > > I have to say I'm surprised that this isn't a problem that's already been > solved by your equipment supplier -- don't they have a velocity or > distance readout already there for you? > > -- > Tim Wescott > Control systems and communications consultinghttp://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
It may be doppler velocimitry which means it is FMd -try using an FM demodulator on I and Q. Wang King
On May 7, 7:26 am, "micdahl" <micd...@u.washington.edu> wrote:
> >Call me a bit too literal, but at rock bottom, the physical meaning of an > I > >and Q signal pair has nothing to do with imaginary numbers. Why? > >Because imaginary numbers don't exist in real life. > > >Physically, the I and Q channels are the result of multiplying the > >incoming signal by the carrier and by a signal that is offset 90 degrees > >in phase from the carrier, then averaging the two resulting signals. > >A signal that is purely in phase with the carrier will give an inphase > >result that is proportional to the signal amplitude and a quadrature > >result that is exactly zero. A signal that is offset by exactly 90 > >degrees from the carrier will give an inphase result of zero and a > >quadrature result that is proportional to the signal amplitude. > > >A very convenient way of modeling this is to say that the inphase and > >quadrature pair form a complex number that can be interpreted in terms > of > >magnitude and phase -- in that sense you are correct. > > >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. > > >I have to say I'm surprised that this isn't a problem that's already > been > >solved by your equipment supplier -- don't they have a velocity or > >distance readout already there for you? > > >-- > >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 > > Wow, it makes a lot more sense if you think about it as just a sine and > cosine multiplied by the original signal and then treat it sort of like a > phasor. > > So it sounds like my velocity is related to the phase angle I and Q make > in the complex plain. I assume that the magnitude of the IQ vector relates > to the signal intensity. > > 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). > > The reason the equipment doesn't do all the work for me is because > ultrasound machines usually pack everything up inside and output something > thats dumbed down and easy for the sonographer to interpret. I'm also using > the machine for a purpose it isn't intended for so I need access to the > data stream at some point so I can get the origional signal before it has > gone through special filters, ect. The best hack I could do was the raw IQ > output. > > Your input has already enlightened me greatly, thank you for your help! > > Michael > > _____________________________________ > Do you know a company who employs DSP engineers? > Is it already listed athttp://dsprelated.com/employers.php?
It's not the phase angle but the rate of change of phase angle phi dot. Wang King
On Sun, 06 May 2007 14:26:01 -0500, micdahl wrote:

>>Call me a bit too literal, but at rock bottom, the physical meaning of an > > I >>and Q signal pair has nothing to do with imaginary numbers. Why? >>Because imaginary numbers don't exist in real life. >> >>Physically, the I and Q channels are the result of multiplying the >>incoming signal by the carrier and by a signal that is offset 90 degrees >>in phase from the carrier, then averaging the two resulting signals. >>A signal that is purely in phase with the carrier will give an inphase >>result that is proportional to the signal amplitude and a quadrature >>result that is exactly zero. A signal that is offset by exactly 90 >>degrees from the carrier will give an inphase result of zero and a >>quadrature result that is proportional to the signal amplitude. >> >>A very convenient way of modeling this is to say that the inphase and >>quadrature pair form a complex number that can be interpreted in terms > > of >>magnitude and phase -- in that sense you are correct. >> >>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. >> >>I have to say I'm surprised that this isn't a problem that's already > > been >>solved by your equipment supplier -- don't they have a velocity or >>distance readout already there for you? >> >>-- >>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 >> > > Wow, it makes a lot more sense if you think about it as just a sine and > > cosine multiplied by the original signal and then treat it sort of like a > > phasor.
I'm glad my view helped. Actually, a phasor _is_ just a way of expressing a complex number; you can dig this out of the web with a bit of work.
> > So it sounds like my velocity is related to the phase angle I and Q make > > in the complex plain. I assume that the magnitude of the IQ vector > relates > > to the signal intensity.
Yes, sort of. The magnitude of the I Q detector is the magnitude of the reflection, but it's the rate of change of the phase angle that relates to velocity.
> > 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.
> > > The reason the equipment doesn't do all the work for me is because > > ultrasound machines usually pack everything up inside and output > something > > thats dumbed down and easy for the sonographer to interpret. I'm also > using > > the machine for a purpose it isn't intended for so I need access to the > > data stream at some point so I can get the origional signal before it > has > > gone through special filters, ect. The best hack I could do was the raw > IQ > > output.
I see. You want it filtered out, too -- just in a different way from what you have now.
> > Your input has already enlightened me greatly, thank you for your help! >
I'm happy to. -- 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
>>>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 ?
On May 7, 5:26 pm, "micdahl" <micd...@u.washington.edu> 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 >
don't forget to divide by sqrt(I^2+Q^2)
Snip

>> >> 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 >> >don't forget to divide by sqrt(I^2+Q^2) > > >
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? Also, shouldn't dI/dt = [I(n)-I(n-2)]/dt where dt = 2/fs in this case? _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?
>Snip > >>> >>> 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 >>> >>don't forget to divide by sqrt(I^2+Q^2) >> >> >> > >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? > >Also, shouldn't dI/dt = [I(n)-I(n-2)]/dt where dt = 2/fs in this case? > >_____________________________________
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) Would anyone care to comment? Thanks! Michael _____________________________________ Do you know a company who employs DSP engineers? Is it already listed at http://dsprelated.com/employers.php ?