Sign in

username or email:

password:



Not a member?
Forgot your password?

Search compdsp



Search tips

Ads

Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGA

Discussion Groups | Comp.DSP | Sampling Complex Signal

There are 23 messages in this thread.

You are currently looking at messages 1 to .


Is this discussion worth a thumbs up?

0

Sampling Complex Signal - Walter Wego - 2012-08-05 09:38:00

Hi,

I know you have to sample above Nyquist or you risk aliases folding into
the passband.

But it if your signal is complex, it seems to me that in a given interval
of time you’ve collected twice the information you would have for a real
signal, or that you’ve effectively doubled your sample rate.

I got that same message when looking through old posts on DSP Related.

I thought that implied that for a basebanded complex signal (for example)
the highest frequency you could correctly reconstruct would be twice that
for a real signal.

But I’m not finding that to be the case in practice, as the Matlab
snippet below shows – the complex signal folds into the passband just as
the real signal does.

While I still have some hair left to tear out, can someone help me
understand where I’m going astray, and why the part 2 of code below gives
the “wrong” result?

Thanks, it’s much appreciated.

Walt

clear all

Fs = 2048;
t  = (0:1/Fs:4-1/Fs);
F1 = 1024+256;
LO = 32;

nyquistfreq = Fs/2
aliasfreq   = Fs-F1

% ----- Part 1 -----

% Create a real, undersampled signal that will fold into passband
x = cos(2*pi*F1*t);

% Calculate the spectrum
NFFT = 1024;
z    = fft(x, NFFT);
Pzz  = abs(z);

% Plot the spectrum
Dec = 1;
f   = ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1);
figure(100);
plot(f, 2*Pzz(1:1+NFFT/2)/NFFT);
axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]);
title('Spectrum of Undersampled Real Signal');

% ----- Part 2 -----

% Translate spectrum of original signal (becomes complex in time)
xs = x .* exp(-i*2*pi*LO*t);

% Calculate the spectrum
NFFT = 1024;
z = fft(xs, NFFT);
Pzz = abs(z);

% Plot the spectrum
Dec = 1;
f = ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1) + LO;
figure(200);
plot(f, 2*Pzz(1:1+NFFT/2)/NFFT);
axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]);
title('Spectrum of Complex Signal');




______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - kaz - 2012-08-05 12:00:00



>Hi,
>
>I know you have to sample above Nyquist or you risk aliases folding into
>the passband.
>
>But it if your signal is complex, it seems to me that in a given interval
>of time you’ve collected twice the information you would have for a
real
>signal, or that you’ve effectively doubled your sample rate.
>
>I got that same message when looking through old posts on DSP Related.
>
>I thought that implied that for a basebanded complex signal (for example)
>the highest frequency you could correctly reconstruct would be twice that
>for a real signal.
>
>But I’m not finding that to be the case in practice, as the Matlab
>snippet below shows – the complex signal folds into the passband just
as
>the real signal does.
>
>While I still have some hair left to tear out, can someone help me
>understand where I’m going astray, and why the part 2 of code below
gives
>the “wrong” result?
>
>Thanks, it’s much appreciated.
>
>Walt
>
>clear all
>
>Fs = 2048;
>t  = (0:1/Fs:4-1/Fs);
>F1 = 1024+256;
>LO = 32;
>
>nyquistfreq = Fs/2
>aliasfreq   = Fs-F1
>
>% ----- Part 1 -----
>
>% Create a real, undersampled signal that will fold into passband
>x = cos(2*pi*F1*t);
>
>% Calculate the spectrum
>NFFT = 1024;
>z    = fft(x, NFFT);
>Pzz  = abs(z);
>
>% Plot the spectrum
>Dec = 1;
>f   = ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1);
>figure(100);
>plot(f, 2*Pzz(1:1+NFFT/2)/NFFT);
>axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]);
>title('Spectrum of Undersampled Real Signal');
>
>% ----- Part 2 -----
>
>% Translate spectrum of original signal (becomes complex in time)
>xs = x .* exp(-i*2*pi*LO*t);
>
>% Calculate the spectrum
>NFFT = 1024;
>z = fft(xs, NFFT);
>Pzz = abs(z);
>
>% Plot the spectrum
>Dec = 1;
>f = ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1) + LO;
>figure(200);
>plot(f, 2*Pzz(1:1+NFFT/2)/NFFT);
>axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]);
>title('Spectrum of Complex Signal');
>
>
>

But sampling only applies to real signal (call it I or Q, Re or Im). It
remains that the ADC must sample correctly each channel separately.

A complex signal cannot exist in real design, instead we have two channels
and process them as if they are members of a complex signal.

Kadhiem


>
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - kaz - 2012-08-05 12:03:00

Remember also a complex approach does not change frequency value of signal
but may eliminate a dc mirror copy

Kadhiem
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - Robert Adams - 2012-08-05 12:07:00

I haven't run your code but I think the conceptual problem is that not all complex signals
are analytic signals. An analytic signal has no negative frequency components. When you
multiplied by exp(I ....) you just made a small circular shift in the frequency domain but you
still have negative frequencies. Instead you should construct your complex signal using x +
i*hilbert(x)

Bob
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - Rick Lyons - 2012-08-05 12:41:00

On Sun, 05 Aug 2012 08:38:11 -0500, "Walter Wego" <61340@dsprelated>
wrote:

>Hi,
>
>I know you have to sample above Nyquist or you risk aliases folding into
>the passband.
>
>But it if your signal is complex, it seems to me that in a given interval
>of time you’ve collected twice the information you would have for a real
>signal, or that you’ve effectively doubled your sample rate.
>
>I got that same message when looking through old posts on DSP Related.
>
>I thought that implied that for a basebanded complex signal (for example)
>the highest frequency you could correctly reconstruct would be twice that
>for a real signal.
>
>But I’m not finding that to be the case in practice, as the Matlab
>snippet below shows – the complex signal folds into the passband just as
>the real signal does.
>
>While I still have some hair left to tear out, can someone help me
>understand where I’m going astray, and why the part 2 of code below gives
>the “wrongâ€? result?
>
>Thanks, it’s much appreciated.
>
>Walt

Hello Walt,
   If I may be so bold, in your spectrum analysis 
modeling I suggest that you always plot the 
full freq spectra range from 0 -to- Fs 
(or -Fs/2 -to- approx. +Fs/2).

Your real signal has a non-zero spectral component at 
768 Hz, and a non-zero spectral component at -768 Hz.

Your complex signal will have the same spectrum 
as the real signal, only the spec components of 
the complex signal will be shifted in the negative 
freq direction by 32 Hz.  Those shifted components 
will reside at -800 and +736 Hz.

Your 2nd plot has an incorrect freq-axis vector.
Suggest you plot using:

  Freq_Axis = (-NFFT/2:(NFFT/2)-1)*(Fs/NFFT);
  plot(Freq_Axis, fftshift(Pzz), '-bs')
  hold on
  plot(Freq_Axis, fftshift(Pzz_2), '-ro')
  hold off
  title('Blue = real sig,   Red = complex sig.')
  xlabel('Hz'), grid on, zoom on

Good Luck,
[-Rick-]
PS.  I've been watching "Breaking Bad" on Netflix.
Walt, would your last name happen to be "White"?

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - Eric Jacobsen - 2012-08-05 12:43:00

On Sun, 05 Aug 2012 08:38:11 -0500, "Walter Wego" <61340@dsprelated>
wrote:

>Hi,
>
>I know you have to sample above Nyquist or you risk aliases folding into
>the passband.
>
>But it if your signal is complex, it seems to me that in a given interval
>of time you’ve collected twice the information you would have for a real
>signal, or that you’ve effectively doubled your sample rate.
>
>I got that same message when looking through old posts on DSP Related.
>
>I thought that implied that for a basebanded complex signal (for example)
>the highest frequency you could correctly reconstruct would be twice that
>for a real signal.
>
>But I’m not finding that to be the case in practice, as the Matlab
>snippet below shows – the complex signal folds into the passband just as
>the real signal does.
>
>While I still have some hair left to tear out, can someone help me
>understand where I’m going astray, and why the part 2 of code below gives
>the “wrong” result?
>
>Thanks, it’s much appreciated.
>
>Walt
>
>clear all
>
>Fs = 2048;
>t  = (0:1/Fs:4-1/Fs);
>F1 = 1024+256;
>LO = 32;
>
>nyquistfreq = Fs/2
>aliasfreq   = Fs-F1
>
>% ----- Part 1 -----
>
>% Create a real, undersampled signal that will fold into passband
>x = cos(2*pi*F1*t);
>
>% Calculate the spectrum
>NFFT = 1024;
>z    = fft(x, NFFT);
>Pzz  = abs(z);
>
>% Plot the spectrum
>Dec = 1;
>f   = ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1);
>figure(100);
>plot(f, 2*Pzz(1:1+NFFT/2)/NFFT);
>axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]);
>title('Spectrum of Undersampled Real Signal');
>
>% ----- Part 2 -----
>
>% Translate spectrum of original signal (becomes complex in time)
>xs = x .* exp(-i*2*pi*LO*t);
>
>% Calculate the spectrum
>NFFT = 1024;
>z = fft(xs, NFFT);
>Pzz = abs(z);
>
>% Plot the spectrum
>Dec = 1;
>f = ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1) + LO;
>figure(200);
>plot(f, 2*Pzz(1:1+NFFT/2)/NFFT);
>axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]);
>title('Spectrum of Complex Signal');


For real-valued signals sampling at Fs provides low-pass support for
signals from zero to Fs/2.     For complex-valued signals sampling at
Fs provides baseband support from -Fs/2 to +Fs/2, or double the
bandwidth of the real-valued case.

So when you put real-valued signal energy at higher than Fs/2, it will
"alias" in either case.


Eric Jacobsen
Anchor Hill Communications
www.anchorhill.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - Rick Lyons - 2012-08-05 12:45:00

On Sun, 05 Aug 2012 09:41:45 -0700, Rick Lyons
<R...@_BOGUS_ieee.org> wrote:


>
>Your 2nd plot has an incorrect freq-axis vector.
>Suggest you plot using:
>
>  Freq_Axis = (-NFFT/2:(NFFT/2)-1)*(Fs/NFFT);
>  plot(Freq_Axis, fftshift(Pzz), '-bs')
>  hold on
>  plot(Freq_Axis, fftshift(Pzz_2), '-ro')
>  hold off
>  title('Blue = real sig,   Red = complex sig.')
>  xlabel('Hz'), grid on, zoom on
>

Oops.
I forgot to mention; the above "Pzz_2" is the 
complex signal's power spectrum.  Sorry 'bout that.

[-Rick-]
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - Rick Lyons - 2012-08-05 12:57:00

On Sun, 05 Aug 2012 11:03:13 -0500, "kaz" <37480@dsprelated> wrote:

>Remember also a complex approach does not change frequency value of signal
>but may eliminate a dc mirror copy
>
>Kadhiem

Whoa, wait!  Multiplying a real-valued signal 
by a negative-frequency complex exponential 
yields a complex-valued time signal whose 
spectrum is different from the real-valued 
signal's spectrum.

[-Rick-]
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - kaz - 2012-08-05 13:14:00

>On Sun, 05 Aug 2012 11:03:13 -0500, "kaz" <37480@dsprelated> wrote:
>
>>Remember also a complex approach does not change frequency value of
signal
>>but may eliminate a dc mirror copy
>>
>>Kadhiem
>
>Whoa, wait!  Multiplying a real-valued signal 
>by a negative-frequency complex exponential 
>yields a complex-valued time signal whose 
>spectrum is different from the real-valued 
>signal's spectrum.
>
>[-Rick-]
>

Of course you can shift signal anywhere to positive or negative frequency
but I am talking about a pair of a given signal as Re/Im. Each of Re or Im
will have mirror image around dc but the pair as a complex signal may have
one copy only depending on their balance. 

Kadhiem
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Sampling Complex Signal - Tim Wescott - 2012-08-05 14:55:00

On Sun, 05 Aug 2012 08:38:11 -0500, Walter Wego wrote:

> Hi,
> 
> I know you have to sample above Nyquist or you risk aliases folding into
> the passband.
> 
> But it if your signal is complex, it seems to me that in a given
> interval of time you’ve collected twice the information you would have
> for a real signal, or that you’ve effectively doubled your sample rate.
> 
> I got that same message when looking through old posts on DSP Related.
> 
> I thought that implied that for a basebanded complex signal (for
> example) the highest frequency you could correctly reconstruct would be
> twice that for a real signal.
> 
> But I’m not finding that to be the case in practice, as the Matlab
> snippet below shows – the complex signal folds into the passband just as
> the real signal does.
> 
> While I still have some hair left to tear out, can someone help me
> understand where I’m going astray, and why the part 2 of code below
> gives the “wrong” result?
> 
> Thanks, it’s much appreciated.

Walter:

It looks like Rick already gave you a good answer to the question you 
were asking, so I'll let that stand (besides, I'm too lazy to look at 
someone else's code -- I have to spend at least 30 seconds per line 
telling myself "no, this is not necessarily crap, it's just that I didn't 
write it").

So instead I'll comment on your assertion that you must sample above 
Nyquist or risk aliasing.  This (and related assertions of varying 
degrees of erroneousness) have been made on this group before, often 
enough that I have an answer all ready for all of them:

http://www.wescottdesign.com/articles/Sampling/sampling.pdf

I'm not sure if the answer for your case is in there.  It is: (a), yes, 
sampling a complex signal gets you (essentially) two samples per 
interval, and hence could Nyquist with half as many samples as you'd 
think, (b), the Nyquist criterion says you need 2 * B total _independent_ 
samples -- if your quadrature samples aren't independent (i.e., if you 
haven't filtered out the lower sideband) then they won't help.

And (c), if you read the paper you'll find that the Nyquist criterion, as 
you state it, is unreachable, because there are no humanly-accessible 
signals of finite bandwidth.  To really use Nyquist's work correctly you 
have to understand how aliasing mucks things up, why it's impossible to 
fully meet the criterion, and (like the story of the mathematician, the 
engineer, and the pretty girl) what you need to do to make your system 
work close enough.

-- 
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?

Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

| 1 | | 3 |