[comp.dsp] Practical DSP problem

paulr@syma.sussex.ac.uk (Paul T Russell) (10/05/90)

I would appreciate any suggestions on practical methods
for extracting spectral information from a noisy signal.
In particular I need to measure the amplitude of
one sinusoidal component (whose frequency is known in
advance) where the amplitude of the component is
close to the noise level. My first thought was to use
an FFT to estimate the power spectrum and then try to
identify the peak, but I feel sure that there must be
a better way. Maybe digital filtering or some other
means of power spectrum estimation (such as the Maximum
Entropy Method) ? Or perhaps I should be doing something
in the time domain, such as autocorrelation + averaging ?

Suggestions, ideas, examples, source code, all welcome.

poser@csli.Stanford.EDU (Bill Poser) (10/06/90)

In order to determine the location of components known to be sinusoidal
in noise, I recommend looking at S. Lawrence Marple, Jr.'s book
_Digital Spectral Analysis with Applications_,
Englewood Cliffs, N.J.: Prentice-Hall, which discusses an unusually
wide range of spectral analysis techniques, including techniques for
high-resolution identification of components of known type in noise.
The eigen-analysis based frequency estimation techniques discussed
in Chapter 13 are probably what you want.

john@qip.UUCP (John Moore) (10/08/90)

In article <3575@syma.sussex.ac.uk> paulr@syma.sussex.ac.uk (Paul T Russell) writes:
]I would appreciate any suggestions on practical methods
]for extracting spectral information from a noisy signal.
]In particular I need to measure the amplitude of
]one sinusoidal component (whose frequency is known in
]advance) where the amplitude of the component is
]close to the noise level. My first thought was to use
]an FFT to estimate the power spectrum and then try to
]identify the peak, but I feel sure that there must be
]a better way. Maybe digital filtering or some other
]means of power spectrum estimation (such as the Maximum
]Entropy Method) ? Or perhaps I should be doing something
]in the time domain, such as autocorrelation + averaging ?

I have an application where I need phase, rather than amplitude, but
the problem is similar. In that case, I compute:

  for i = 0 through a bunch
   I = sum(sinwt*sample[i])
   Q = sum(coswt*sample[i])

  A = sqrt(I*I + Q*Q)
  P = arctan(I/Q)
  
This is equivalent to computing just one line of the PSD from the DFT.
I do this in real time with an 8 bit uP running at .25 itty-bitty-Mips.

I suspect autocorrelation would work even better, if you really know the
frequency, and you don't care about the phase. 

Given that you know the frequency, I don't think you require anything
fancier than this. The algorithm shown above is simple enough that it
can be done in real time (on audio) with most microprocessor chips.
No need for a DSP or even a real fast micro (unless you are sampling
real fast and going for high precision/dynamic range).


-- 
John Moore HAM:NJ7E/CAP:T-Bird 381 {ames!ncar!noao!asuvax,mcdphx}!anasaz!john 
USnail: 7525 Clearwater Pkwy, Scottsdale,AZ 85253 anasaz!john@asuvax.eas.asu.edu
Voice: (602) 951-9326        Wishful Thinking: Long palladium, Short Petroleum
Opinion: Support ALL of the bill of rights, INCLUDING the 2nd amendment!
Disclaimer: The opinions expressed here are all my fault, and no one elses.

mattila@hemuli.tik.vtt.fi (Sakari Mattila) (10/08/90)

 
On finding a sine wave of known frequency buried in noise ...
 
If you know the phase of the sine, how about summing it for some
tens or even thousands of cycles ?  If you do not know the phase,
how about programming a PLL (Phase Locked Loop) ?  PLL is good
at finding the signal, if the signal is stable in frequency and
phase. If your signal is variable, try to filter it out of the noise.
 

 
-- 
Sakari M. Mattila    71307.1525@CompuServe.COM
                     mattila@tik.vtt.fi    Sakari Mattila@3:663*371.0.FNET

bobc@hplsla.HP.COM (Bob Cutler) (10/08/90)

>
>I have an application where I need phase, rather than amplitude, but
>the problem is similar. In that case, I compute:
>
>  for i = 0 through a bunch
>   I = sum(sinwt*sample[i])
>   Q = sum(coswt*sample[i])
>
>  A = sqrt(I*I + Q*Q)
>  P = arctan(I/Q)
>  
>This is equivalent to computing just one line of the PSD from the DFT.
>I do this in real time with an 8 bit uP running at .25 itty-bitty-Mips.
>

This will work even better if the time interval from 0 to 'a bunch' covers
an integral number of cycles of sin(wt). 
---

					Bob Cutler
					KE7ZJ
					Lake Stevens Instrument Division
 					Hewlett-Packard
					Everett, WA

paulr@syma.sussex.ac.uk (Paul T Russell) (10/09/90)

From article <5169@hemuli.tik.vtt.fi>, by mattila@hemuli.tik.vtt.fi (Sakari Mattila):
> 
> On finding a sine wave of known frequency buried in noise ...
>  
> If you know the phase of the sine, how about summing it for some
> tens or even thousands of cycles ?

I think this would only work if the noise had a nice amplitude
distribution. In our case, it's probably not nicely distributed.
Also, I think it would take too long (ie. too many samples) to
get a reasonable result. We are sampling at 44.1 kHz and need
results within around 1 second.

> If you do not know the phase,
> how about programming a PLL (Phase Locked Loop) ?  PLL is good
> at finding the signal, if the signal is stable in frequency and
> phase. If your signal is variable, try to filter it out of the noise.

We don't know the absolute phase of the signal but we do know the
exact frequency. We are generating two sine waves at frequencies
f1 and f2 and trying to measure the distortion product at 2f1 - f2.
The signal is swamped by the two much larger components at f1 and
f2, and is close to the noise level. 
-- 
           Paul Russell, Department of Experimental Psychology
         University of Sussex, Falmer, Brighton BN1 9QG, England
     Janet: paulr@uk.ac.sussex.syma  Nsfnet: paulr@syma.sussex.ac.uk
    Bitnet: paulr%sussex.syma@ukacrl.bitnet  Usenet: ...ukc!syma!paulr

harrison@sunwhere.DAB.GE.COM (Gregory Harrison) (10/09/90)

In article <9360012@hplsla.HP.COM> bobc@hplsla.HP.COM (Bob Cutler) writes:
>>
>>I have an application where I need phase, rather than amplitude, but
>>the problem is similar. In that case, I compute:
>>
>>  for i = 0 through a bunch
>>   I = sum(sinwt*sample[i])
>>   Q = sum(coswt*sample[i])

I believe that this is called the Geotzel method, and should be documented	in good DSP texts.  It is much more costly to compute an entire spectrum in 
this manner, but I would guess that it works just fine with single line 
spectra.  I wonder if you could use a window on it.  I wonder if you could
process a wigner kernel in this manner.  I believe that using this method
you create a tuned filter.  I wonder how to handle non-stationary cases.

Score:  3 wonders, 3 tidbits of info.

Greg

phil@ux1.cso.uiuc.edu (10/10/90)

> We don't know the absolute phase of the signal but we do know the
> exact frequency. We are generating two sine waves at frequencies
> f1 and f2 and trying to measure the distortion product at 2f1 - f2.
> The signal is swamped by the two much larger components at f1 and
> f2, and is close to the noise level. 

That might even be better.  If you have f1 and f2 as separate components,
you can generate 2*(f1-f2) directly from them by multiplying the instant
values of the squares of f1 and f2 generating 2*(f1-f2).  No sin/cos
calculations or tables; just some multiplies.  You will need to subtract
out the DC from those multiplications.  If f1 and f2 are of stable amplitude
(and hence no sidebands to crossmodulate) then removing the DC should be
easy.

--Phil Howard, KA9WGN-- | Individual CHOICE is fundamental to a free society
<phil@ux1.cso.uiuc.edu> | no matter what the particular issue is all about.

sam@hemuli.tik.vtt.fi (Sakari Mattila) (10/10/90)

 
In old good analog world, I would high-pass or band reject filter these
fundamental frequencies. Then it could be possible to recover the wanted
mixed harmonic using autocorrelation or band-pass filtering.  I suppose,
that tit is necessary to measure a band around the measured harmonic in
order to estimate the increase of general noise level in your circuit
caused by the test signals f1 and f2. 
 
-- 
Sakari M. Mattila    71307.1525@CompuServe.COM
                     mattila@tik.vtt.fi    Sakari Mattila@3:663*371.0.FNET

am299aw@sdcc6.ucsd.edu (Gregory Breit) (10/12/90)

In article <3594@syma.sussex.ac.uk> paulr@syma.sussex.ac.uk (Paul T Russell) writes:
>
>We don't know the absolute phase of the signal but we do know the
>exact frequency. We are generating two sine waves at frequencies
>f1 and f2 and trying to measure the distortion product at 2f1 - f2.
>The signal is swamped by the two much larger components at f1 and
>f2, and is close to the noise level. 

An approach you might consider would be to use a variation on the
Prony Spectral Line Estimator.  The PSLE is especially well suited
for spectral analysis of signals containing a finite number of
discrete sinusoids.  Check out these papers:

Meyer, et al, The Prony Spectral Line Estimation (PSLE) Method for
the Analysis of Vascular Oscillations.  IEEE Trans. Biomed. Eng.
36(9), 968-971, 1989.

Kay, SM, and SL Marple, Spectrum Analysis--A Modern Perspective.
Proc. IEEE, 69(11), 1380-1419, 1981.

Also, Marple's new book on spectral analysis (I don't remember the
title) has a chapter on this stuff.

The PSLE is basically a two-step process which utilizes a clever
linearization of the problem of fitting a finite # of sinusoids to
a signal.  The first, and most complicated step actually determines
the frequencies themselves (which you already know).  The second
step is merely a linear least squares fit of those frequencies to
the data.  The complex amplitude you get from that step allows you
to determine the best combination of amplitude and phase which fits
the data.  You might find it useful to apply a linear least squares
to find the most likely amplitude of your sinewave buried in noise.
LLS is a pretty common problem, you should be able to find some
source code.  Good luck.

Gregory Breit
Department of Applied Mechanics and Engineering Sciences, UCSD
am299aw@sdcc6.ucsd.edu

paulr@syma.sussex.ac.uk (Paul T Russell) (10/12/90)

From article <1028600001@ux1.cso.uiuc.edu>, by phil@ux1.cso.uiuc.edu:
> you can generate 2*(f1-f2) directly from them by multiplying the instant
> values of the squares of f1 and f2 generating 2*(f1-f2).  No sin/cos

Just to clarify - it's 2*f1-f2, not 2*(f1-f2), but thanks for the
feedback anyway...

//Paul

-- 
           Paul Russell, Department of Experimental Psychology
         University of Sussex, Falmer, Brighton BN1 9QG, England
     Janet: paulr@uk.ac.sussex.syma  Nsfnet: paulr@syma.sussex.ac.uk
    Bitnet: paulr%sussex.syma@ukacrl.bitnet  Usenet: ...ukc!syma!paulr