DSPRelated.com
Forums

Converting complex signals to real

Started by diane February 26, 2006
Hello:

I'm trying to figure out how best to convert a complex signal to a
real.  I've heard of one approach that says to take the magnitude of
the complex sample and use that as the real sample. And another
approach where you just drop the imaginary part.

Are there other techniques?

If I'm looking to convert the complex signal to an audio format, is one
approach better than the other?

I'm also wondering what happens to the spectrum of the signal if it is
converted from complex to real.  Would the negative frequencies just be
replaced by a copy of the positive ones?

If you can't tell from the questions, I'm pretty new to DSP. I could
sure use some help and guidance. I can't find much on the web about
converting in this direction.

Thanks, 
Diane

Hi,

How did you obtain the complex signal ?
If the complex signal is a result of using the Fourier Transform on a
previous audio data than you are better off converting the complex
signal to a real signal by doing an inverse fourier transform and
ignoring the resulting imaginary part *after* the inverse transform.

>I'm also wondering what happens to the spectrum of the signal if it is >converted from complex to real. Would the negative frequencies just be >replaced by a copy of the positive ones
In general. the spectrum of a real signal has even symmetry in Magnitude and odd symmetry in the phase component (it's fourier transform is conjugate symmetric). For complex signals, the real part will contribute to the even-symmetric part of the spectrum and imaginary part to the odd part of the spectrum (ie, Re[x] -> Xeven(exp(jw)) and j*Imag[x]-> Xodd(exp(jw)) ). If you still need more information perhaps you can give us more detail on how you obtained the signal and what exactly you are trying to do... Other conversions might be possible as well (ie, if the signal is a result of a phase delay of a real signal, or real signal phase shifted)... hth, Ikaro
"diane" <dianeayers@cablespeed.com> wrote in message 
news:1140979908.769852.66230@z34g2000cwc.googlegroups.com...
> Hello: > > I'm trying to figure out how best to convert a complex signal to a > real. I've heard of one approach that says to take the magnitude of > the complex sample and use that as the real sample. And another > approach where you just drop the imaginary part. > > Are there other techniques? > > If I'm looking to convert the complex signal to an audio format, is one > approach better than the other? > > I'm also wondering what happens to the spectrum of the signal if it is > converted from complex to real. Would the negative frequencies just be > replaced by a copy of the positive ones? > > If you can't tell from the questions, I'm pretty new to DSP. I could > sure use some help and guidance. I can't find much on the web about > converting in this direction.
One should first ask, why do you want to do this? What is the orgin of the complex signal? Here are some examples that might lend insight: Start with a notion of a signal in the frequency domain / Fourier Transform domain. Let's say you start with a single unit sample at frequency fx. Compute the inverse Fourier Transform. The resulting signal in the time domain is complex. This is compared to starting with a unit sample at fx and another at fs-fx. Compute the inverse Fourier Transform. The resulting signal in the time domain is real. So, the "problem" is that the frequency domain representation didn't lend itself to yielding a signal in time that is real. It's all in the representation and not in the intent. Here are some identities that help me: A real, even time signal has a real, even Fourier Transform. A real, odd time signal has an imaginary, odd Fourier Transform. An imaginary, even time signal has an imaginary, even Fourier Transform An imaginary, odd time signal has a real, odd Fourier Transform. Signals can be split into even and odd parts: Ev[f(t)] = [f(t) + f(-t)]/2 Od[f(t)] = [f(t) - f(-t)]/2 Obviously, if f(t) is already even then f(t) - f(-t) = 0 And, if f(t) is already odd, then f(t) + f(-t) = 0 The same splitting into Even and Odd can be done in the frequency domain of course. Complex signals can be split into Even and Odd parts of the Real and Imaginary parts: f(t)=Re[f(t)] + jIm[f(t)] = Ev{Re[f(t)]} + Od{Re[f(t)]} +j [Ev{Im[f(t)]} + Od{Im[f(t)]} and you can use the identities above to figure out how a particular form of signal will look in the opposite domain. These identities can be useful. Now, assume that you have a real, even signal in time. That means specifically that it's symmetrical around t=0. And, its Fourier Transform will be real and even. But, let's say you take this real,even signal and "start" it at t=0 instead of centering it at t=0(representing a delay) then the Fourier Transform will be complex. Also, not that this signal now has both even and odd parts. Ah well .... back to your question: Taking the magnitude is a nonlinear operation. e.g. it would take a pure sinusoid and rectify it causing lots of distortion. Dropping the imaginary part would reduce the signal to zero if it's all imaginary to begin with. That's probably not what you want either. Consider this: The *inverse Fourier* Transform is a process by which a temporal waveform is built up out of a sum (or integral) of individual sinusoids. Depending on the phase / how much is real and how much is imaginary at each frequency / there is a contribution of a cosine term from the real part and of a sine term from the imaginary part. If it is purely imaginary and odd in frequency then it's real and odd in time - a sine. If it is purely real and even in frequency then it's real and even in time - a cosine. Any real signal in time is a combinaton of the two - at each frequency. A classical method for converting complex signals into real ones is to multiply the real part by a cosine and the imaginary part by a sine and adding the results to get a real signal. That's perhaps what you want to do. Let's assume that you have a complex signal with bandwidth B for the real part and bandwidth B for the imaginary part. The signal can occupy a spectral region from -B/2 to +B/2. However, to be real it has to occupy a bandwidth of 2B or from -B to +B. To make this happen you have to multiply the real and imaginary components by cos(B/2) and sin(B/2) respectively and add the results. Choosing the frequency of these sinusoids is part of the challenge because it's likely that you got the complex representation by mixing at some frequency to yield a baseband complex "envelope" or "analytic signal". Fred NB: I did this in a hurry without checking everything carefully. So use for ideas but use caution in actual implementation! There could be factors missing or just plain off.