DSPRelated.com
Forums

fft

Started by JB September 7, 2007
I have a signal that contains pulses of frequencies.  So for example,
between times 'a' and 'b' there are 5 cycles of 2kHz, between times
'c' and 'd' there are no cycles of any frequencies and between times
'e' and 'f' there are another 5 cycles of 2kHz.

By analysing the data in software I need to identify where these
frequencies occur, i.e. I need to know the times a,b and e,f.

Can someone tell me the best way to do this.  I am currently trying to
implement this by cross correlating the data with an ideal signal at
the required frequencies.

Would this be possible with an FFT, would an FFT tell me all the
locations of pulses?  The little experience I have with FFTs tells me
that I would just get one phase value from the FFT for each frequency
that would not facilititate even locating the first pulse?

Thanks,

Joseph

Hello,
yes, you can use FFT.

Here is an example:
http://www.elisanet.fi/mnentwig/webroot/SNR_FFT_correlation_example/index.html

 The crosscorrelation is calculated as ifft(fft(signal) .*
fft(original_pulse)), where the latter is the short original pulse, padded
to the same length as the total signal.

Needless to say, the method can be quite inefficient. But it's a good
choice if you have the computing power and plenty of other worries.

Cheers

Markus

On Sep 7, 4:52 am, JB <josephby...@yahoo.com> wrote:
> I have a signal that contains pulses of frequencies. So for example, > between times 'a' and 'b' there are 5 cycles of 2kHz, between times > 'c' and 'd' there are no cycles of any frequencies and between times > 'e' and 'f' there are another 5 cycles of 2kHz. > > By analysing the data in software I need to identify where these > frequencies occur, i.e. I need to know the times a,b and e,f. > > Can someone tell me the best way to do this. I am currently trying to > implement this by cross correlating the data with an ideal signal at > the required frequencies. > > Would this be possible with an FFT, would an FFT tell me all the > locations of pulses? The little experience I have with FFTs tells me > that I would just get one phase value from the FFT for each frequency > that would not facilititate even locating the first pulse? > > Thanks, > > Joseph
If the only frequency of interest is 2 kHz, why not use a bandpass filter? If the SNR is high, how about an envelope detector? John
>> Can someone tell me the best way to do this
Or then if we are concerned about efficiency - Downconvert to complex baseband by multiplication with exp(-i*2*pi*t*2000), t in seconds - Use appropriate lowpass filters on real/imaginary part, matched to the pulse envelope (probably ideal lowpass if it's rectangular) - Take I^2+Q^2 and compare to threshold -mn
Yes, efficiency is my concern here, so I worry about the FFT
Correlation.

I like the idea of using filters either the band pass or downconvert
with low pass filter.

Unfortunately I am not savvy anough to understand fully what you are
suggesting, I am probably a little out of my depth:

_what is an envelope detector, is there something I can read about for
this?

"Downconvert to complex baseband by multiplication with
exp(-i*2*pi*t*2000), t in seconds"

Are you saying multiply each data point by exp(...)?  How does this
give me real and imaginary parts?

- Use appropriate lowpass filters on real/imaginary part, matched to
the
pulse envelope (probably ideal lowpass if it's rectangular)

Anywhere I can read about this?

What are I^2 and Q^2, are these the real and imaginary parts?

Thanks again.



OK, forget about the FFT approach then.
Is this an actual engineering job, or a homework problem?

-mn
This is an an actual engineering project, but for a personal project I
am working on.  I write software for a living C#, so if there were any
free C# modules out there you know of that would be useful?

Thanks.


On 7 Sep, 12:21, "mnentwig" <mnent...@elisanet.fi> wrote:
> OK, forget about the FFT approach then. > Is this an actual engineering job, or a homework problem? > > -mn
JB wrote:
> Yes, efficiency is my concern here, so I worry about the FFT > Correlation. > > I like the idea of using filters either the band pass or downconvert > with low pass filter. > > Unfortunately I am not savvy anough to understand fully what you are > suggesting, I am probably a little out of my depth: > > _what is an envelope detector, is there something I can read about for > this? > > "Downconvert to complex baseband by multiplication with > exp(-i*2*pi*t*2000), t in seconds" > > Are you saying multiply each data point by exp(...)? How does this > give me real and imaginary parts?
Euler's Formula: e^(i*x) = cos(x) + i*sin(x) Basically, to get the real part, you multiply your sequence by cos(2*pi*2000*t). To get the imaginary part, you use sine instead of cosine.
> > - Use appropriate lowpass filters on real/imaginary part, matched to > the > pulse envelope (probably ideal lowpass if it's rectangular) > > Anywhere I can read about this?
http://www.dspguide.com
> > What are I^2 and Q^2, are these the real and imaginary parts?
Yes. In fact, this operation is very much the same as calculating a single component of a DFT (the 2000Hz component in your case). In a DFT, the LP filter is a simple sum of the products obtained by multiplying the input signal by the two sinusoids. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Any sufficiently advanced technology is indistinguishable from magic. - Arthur C. Clarke
Hello, again.

here is a simple solution, namely a matched filter receiver (or
correlation, it depends how you look at it).

The reversed pulse simply goes into the coefficients of a FIR filter.
Using it on the signal gives a peak at the filter output, when a pulse was
received.
It's the optimum _linear_ receiver.

There are a lot of other peaks, but that's a problem with the signal, not
the receiver. Maybe it's easier to use a different pulse shape, for
example chirp.

I put together a short matlab example here:
http://www.elisanet.fi/mnentwig/webroot/optimum_receiver/index.html
The "green" pulses are aligned with the end of the pulse.

The previous solution with exp(-i ...) can help to implement this scheme
more efficiently, but probably the above solution will work just fine for
a five-cycle pulse. 

Cheers

Markus
OK,

So let me see if I have got this right.  To search for pulses of a
particular frequency in a real array of data I do the following:

multiply each point in the array by real = cos(t*2*Pi*frequency)  and
imag = sin(t*2*Pi*frequency)

apply a low pass filter to each of the real and imag components
separately

examine real^2 + imag^2 for exceeding some threshold?

Is this correct?  You mention using a single component of a DFT as the
Low Pass filter in the second stage, is this also correct?

Thanks,

Joseph