DSPRelated.com
Forums

Sampling Complex Signal

Started by Walter Wego August 5, 2012
>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'); >
another issue related to your work is that as far as I know, Matlab does not and cannot model oversampling. In fact there is no concept of absolute frequency in this tool and the time vector you generate is just a phase factor. Imagine you start with low frequency then you will have (n) samples per cycle. Then to increase frequency you lower the number of sine samples per cycle until you reach just two samples per cycle. Beyond which you end up with dc. Matlab sees vector of samples. It cannot see actual analogue model to choose samples from. Thus it only shows spectrum from 0 to 1 (scaled by you to your physical frequency). In short, there is no time dimension in modelling. Time dimension comes in when you physically read your sine samples on a given sampling frequency. Kadhiem
> >
One way to emulate aliasing in Matlab would be to generate a tone table
with (n) samples per cycle. Then pick up samples from table regularly but
less than 1 sample per cycle. 

Kadhiem
>One way to emulate aliasing in Matlab would be to generate a tone table >with (n) samples per cycle. Then pick up samples from table regularly but >less than 1 sample per cycle. > >Kadhiem >
sorry, less than 2 actually e.g. x = exp(j*2*pi*(0:2^16-1)*.1); %table, 10 sample/cycle y = x(1:9:end); so y should alias somewhere between 0 & .5 kadhiem
This article covers the OP's questions quite well.

http://www.hyperdynelabs.com/dspdude/papers/quadrature%20signal%20processin=
g%20redux.pdf


I would maintain that this half-sampling-rate effect only works if the inpu=
t is an analytic signal with no negative frequency components. Otherwise th=
e cancellation that occurs after the real and imaginary components are sepa=
rately sampled and then recombined into a sampled complex signal will not o=
ccur.



On Sunday, August 5, 2012 9:38:11 AM UTC-4, Walter Wego wrote:
> Hi, >=20 >=20 >=20 > I know you have to sample above Nyquist or you risk aliases folding into >=20 > the passband. >=20 >=20 >=20 > But it if your signal is complex, it seems to me that in a given interval >=20 > of time you=92ve collected twice the information you would have for a rea=
l
>=20 > signal, or that you=92ve effectively doubled your sample rate. >=20 >=20 >=20 > I got that same message when looking through old posts on DSP Related. >=20 >=20 >=20 > I thought that implied that for a basebanded complex signal (for example) >=20 > the highest frequency you could correctly reconstruct would be twice that >=20 > for a real signal. >=20 >=20 >=20 > But I=92m not finding that to be the case in practice, as the Matlab >=20 > snippet below shows =96 the complex signal folds into the passband just a=
s
>=20 > the real signal does. >=20 >=20 >=20 > While I still have some hair left to tear out, can someone help me >=20 > understand where I=92m going astray, and why the part 2 of code below giv=
es
>=20 > the =93wrong=94 result? >=20 >=20 >=20 > Thanks, it=92s much appreciated. >=20 >=20 >=20 > Walt >=20 >=20 >=20 > clear all >=20 >=20 >=20 > Fs =3D 2048; >=20 > t =3D (0:1/Fs:4-1/Fs); >=20 > F1 =3D 1024+256; >=20 > LO =3D 32; >=20 >=20 >=20 > nyquistfreq =3D Fs/2 >=20 > aliasfreq =3D Fs-F1 >=20 >=20 >=20 > % ----- Part 1 ----- >=20 >=20 >=20 > % Create a real, undersampled signal that will fold into passband >=20 > x =3D cos(2*pi*F1*t); >=20 >=20 >=20 > % Calculate the spectrum >=20 > NFFT =3D 1024; >=20 > z =3D fft(x, NFFT); >=20 > Pzz =3D abs(z); >=20 >=20 >=20 > % Plot the spectrum >=20 > Dec =3D 1; >=20 > f =3D ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1); >=20 > figure(100); >=20 > plot(f, 2*Pzz(1:1+NFFT/2)/NFFT); >=20 > axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]); >=20 > title('Spectrum of Undersampled Real Signal'); >=20 >=20 >=20 > % ----- Part 2 ----- >=20 >=20 >=20 > % Translate spectrum of original signal (becomes complex in time) >=20 > xs =3D x .* exp(-i*2*pi*LO*t); >=20 >=20 >=20 > % Calculate the spectrum >=20 > NFFT =3D 1024; >=20 > z =3D fft(xs, NFFT); >=20 > Pzz =3D abs(z); >=20 >=20 >=20 > % Plot the spectrum >=20 > Dec =3D 1; >=20 > f =3D ((Fs/2) / Dec) * linspace(0, 1, NFFT/2+1) + LO; >=20 > figure(200); >=20 > plot(f, 2*Pzz(1:1+NFFT/2)/NFFT); >=20 > axis([f(1), f(end), 0, 1.01*max(2*Pzz(1:1+NFFT/2)/NFFT)]); >=20 > title('Spectrum of Complex Signal');
eric.jacobsen@ieee.org (Eric Jacobsen) writes:
> [...] > 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.
Very succinctly put, and I agree cuts right to the issue. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
>Good Luck, >[-Rick-] >PS. I've been watching "Breaking Bad" on Netflix. >Walt, would your last name happen to be "White"? >
Yes, that's me! I posted because I'm doing research for my role in the upcoming series "Breaking Code". How did you figure it out? Seriously, I'm flattered to get a response from one of my favorite authors. To everyone, I can't thank you enough for you considerate sharing. I will be going through each post in detail and may finally get a restful night's sleep. (Plus, keep a little hair!) Regards, Walt
On Sun, 5 Aug 2012 13:18:49 -0700 (PDT), Robert Adams
<robert.adams@analog.com> wrote:

>This article covers the OP's questions quite well. > >http://www.hyperdynelabs.com/dspdude/papers/quadrature%20signal%20processing%20redux.pdf > > >I would maintain that this half-sampling-rate effect only works if the input is an analytic signal with no negative frequency components. Otherwise the cancellation that occurs after the real and imaginary components are separately sampled and then recombined into a sampled complex signal will not occur. >
Hello Robert, Thanks for the URL to Jim Shima's material. I like Shima's writing, and I thought it was very smart of him to use both solid-line and dashed-line arrows in his spectral plots. By the way, I don't think we should use the phrase "folding frequency" when we talk about complex- valued signals. Complex-valued signals do NOT "fold" at Fs/2 as do real-valued signals. Shima's Figure 3(d) demonstrates what I'm saying. One thing: in the 3rd paragraph of page 7, Shima says the Figure 3(d) signal is analytic. I don't think it is, strictly speaking. I'd like to hear Clay Turner's opinion on this. See Ya', [-Rick-]
On Thursday, August 9, 2012 5:39:18 AM UTC-4, Rick Lyons wrote:
> On Sun, 5 Aug 2012 13:18:49 -0700 (PDT), Robert Adams >
> > > > >This article covers the OP's questions quite well. > > > > > >http://www.hyperdynelabs.com/dspdude/papers/quadrature%20signal%20processing%20redux.pdf > > > > > > > > >I would maintain that this half-sampling-rate effect only works if the input is an analytic signal with no negative frequency components. Otherwise the cancellation that occurs after the real and imaginary components are separately sampled and then recombined into a sampled complex signal will not occur. > > > > > > > Hello Robert, > > Thanks for the URL to Jim Shima's material. > > > > I like Shima's writing, and I thought it was > > very smart of him to use both solid-line and > > dashed-line arrows in his spectral plots. > > > > By the way, I don't think we should use the phrase > > "folding frequency" when we talk about complex- > > valued signals. Complex-valued signals do NOT > > "fold" at Fs/2 as do real-valued signals. > > Shima's Figure 3(d) demonstrates what I'm > > saying. > > > > One thing: in the 3rd paragraph of page 7, > > Shima says the Figure 3(d) signal is analytic. > > I don't think it is, strictly speaking. > > I'd like to hear Clay Turner's opinion on > > this. > > > > See Ya', > > [-Rick-]
Technically analytic signals that are formed from compositing a real signal, x(t) with j*Hilbert(x(t)) will have spectra that are zero for negative frequencies. If instead you make your "one sided" signal by x(t) - j*Hilbert(x(t)), then your spectrum will be zero for positive frequencies. I think the main point of Shima's exposition is if you can reduce your real signal to one with a one sided spectrum, then you have double the frequency space (sampled systems with bandlimited signals) in which to work. I've exploited this idea in digital phase locked loops where I didn't need as high of sample rate as a Costas loop would have needed. Shima can change the operations around to zero out the negative frequencies instead of the positive ones. Clay
On Thu, 09 Aug 2012 02:39:18 -0700, Rick Lyons
<R.Lyons@_BOGUS_ieee.org> wrote:

>On Sun, 5 Aug 2012 13:18:49 -0700 (PDT), Robert Adams ><robert.adams@analog.com> wrote: > >>This article covers the OP's questions quite well. >> >>http://www.hyperdynelabs.com/dspdude/papers/quadrature%20signal%20processing%20redux.pdf >> >> >>I would maintain that this half-sampling-rate effect only works if the input is an analytic signal with no negative frequency components. Otherwise the cancellation that occurs after the real and imaginary components are separately sampled and then recombined into a sampled complex signal will not occur. >> > >Hello Robert, > Thanks for the URL to Jim Shima's material. > >I like Shima's writing, and I thought it was >very smart of him to use both solid-line and >dashed-line arrows in his spectral plots. > >By the way, I don't think we should use the phrase >"folding frequency" when we talk about complex- >valued signals. Complex-valued signals do NOT >"fold" at Fs/2 as do real-valued signals. >Shima's Figure 3(d) demonstrates what I'm >saying.
I tend to agree, but I don't really like the idea of "folding frequency" in the first place. I think it always has to be taken in the context of the system and where the expected signals will be in the frequency domain. A system that takes complex-valued samples at Fs can unambiguously support a bandwidth of Fs. The desired bandwidth can be essentially anywhere and not even sensibly aligned with Fs or even contiguous. From this perspective the cyclic behavior of the sampled spectrum doesn't really "fold" anywhere. But there is an unresolvable frequency ambiguity at Fs/2 for complex-valued sampling and we know that some nasty stuff happens at Fs/2 for real-valued sampling. Whether that is a good demarcation for calling something a "folding frequency" or not is arguable. I think it makes the case that there is not really the purest mathematical continuity from 0 to Fs since there's a bit of a wart at Fs/2. For this reason I think it's better to say that complex-valued sampling systems support a contiguous baseband from -Fs/2 to +Fs/2 rather than from 0 to Fs as Mr. Shima does. It does seem to be a matter of perspective, though, and one can muddle through and get good results with a different points of view.
>One thing: in the 3rd paragraph of page 7, >Shima says the Figure 3(d) signal is analytic. >I don't think it is, strictly speaking. >I'd like to hear Clay Turner's opinion on >this. > >See Ya', >[-Rick-] > >
Eric Jacobsen Anchor Hill Communications www.anchorhill.com
I tend to visualize the sampling theory as a convolution where the spectrum of the sampling sequence (regularly spaced sticks) is convolved with the spectrum of the analog signal, which is double-sided if the signal is real. Therefore you need a sample rate 2*fmax to avoid any aliasing. However if you clear out one half of the signal spectrum by making it an analytic signal, you can make the sample-rate equal to fmax without any aliasing.  This is a nice visual that allows me to avoid math, since all the math fell out of my head around 1980 as far as I can tell.

So I think the mistake the OP made was to assume that a signal is analytic just because it's complex. While all analytic signals are complex, not all complex signals are analytic.


Bob