Filtering In Frequency Domain v Time Domain

If the goal is to determine a phase angle between two signals,

Bret,

What are you trying to do?

Match filter with an out of phase reference. For awhile I thought it
wouldn't matter and in fact the absolute value in the frequency domain
is the same for two signals that are identical except for a phase
angle..

But after trying it out on Excel it seems the phase angle must still
be calculated from the real and imaginary components, the difference
in the angles between the signals.

The noise will probably require some kind of average of the phase
angles.

An iterative technique may be necessary. First you get an estimate of
the phase angle from the noisy signal and reference then you phase
adjust the reference then you match filter then you recheck to see if
the phase angle is converging.

If you're seeing the magnitude of the matched filter output change
based on a constant phase shift between the signal you're processing
and the reference, then you're doing something wrong.
The magnitude of the reference and the signal are, in fact, identical
in the frequency domain for every frequency bin. Just take IMABS() of
the complex FFT of both on Excel. It's only after the dot product is
taken of the reference and the signal that the magnitude drops for a
phase shift. This, of course, holds for the INV FFT.

SPICE seems to give the same results. In the FFT multiply two noisy
signals that are identical except for phase angles by the same
reference. As might be expected this will knock down the noise peaks
in both signals by a few dB, at least more than the signal peaks, and
make you feel like you are doing some kind of reference filtering.

But if you divide the small phase angle signal by the large phase
angle signal you get a dip at the noise frequency in the quotient This
might indicate the signal with the larger phase angle has more noise.
This would be expected if the "reference frequency filter" needs to
have 0 phase angle for best results.

SPICE doesn't give you the real and imaginary parts so you can't see
everything they are doing. That's why I'm qualifying everything so
much.

Phase sensitive rectification, of course, will also give different
results for different phase angles. To get the amplitude you must
know the phase angle.

Convolution is a
linear operation. A constant phase shift on the template signal is
equivalent to multiplying the reference by exp(j*theta), a constant.
Therefore, if;

y[n] = conv(x[n], r[n])

Then:

exp(j*theta) * y[n] = conv(x[n], exp(j*theta) * r[n])

The magnitudes of y[n] and exp(j*theta) * y[n] are equal for all n (a
phase shift does not affect the magnitude of a complex number). So, if
you're observing that this is not the case, something is wrong with
your simulation.

Note that you will see attenuation if there is a *frequency* offset
between the signal and the reference;
That may be the problem.

this is a well-known phenomenon
for communication receivers that use "long" correlators, such as
direct-sequence spread-spectrum systems. If the frequency offset
between the transmitter and receiver is a significant fraction of the
inverse of the reference's length in time, then you will start to
observe attenuation in the matched filter's output. This problem is
often addressed by using a bank of parallel correlators, spaced in
frequency, such that the signal of interest will be near the center of
one of the filters in the bank.
Thanks. Couldn't a bank be used in the time domain (PSR) when you
don't know the phase angle? It might require a high SNR level.


Bret Cahill
 
On 3/7/2011 11:28 AM, Bret Cahill wrote:

How in the world did PSR get into this thread?

It was a stepping stone to using Excel for match filtering.
***But PSR isn't much of anything like matched filtering in terms of
implementation.....

I thought we were
talking about matched filters and whether there were any differences
between time domain implementation and frequency domain implementation.

It's no longer of interest so feel free to ignore it.
***OK. You're welcome.

OK, I found a description:http://techdoc.kvindesland.no/radio/ymse1/20061216153544735.pdf

Geez. This looks a lot like a phase-locked loop (PLL) receiver of the
sort that's used, for example, in deep space communications.

The time multiplication step is the heart of PSR and lock in.
***Actually the time multiplication step is a trivial part of it. The
heart of it is getting the frequency and phase adjusted to get lock.

In those
applications, the data bandwidth is very low so that the receiver
bandwidth can be very low (thus improving SNR at the output).

Matched filters are most often used in pulse systems like radar and
sonar; although they tend to work better in radar. There's a ton of
literature on the subject.

PLL receivers tend to work on continuous signals. There is generally a
"lock" period to get the phase right and the receiver can also "lose lock".

The phase may not always be known in which case it won't work for
precision amplitude measurements. It may very well be worse than the
noise.
***The phase is never known unless there's a phase reference as in a
suppressed carrier control system and that's mostly used to know the *sign*.

The difference seems rather stark to me.

It would be surprising if the two types of reference or "adaptive"
filtering weren't compared before now.
Well, there's nothing adaptive in this conversation yet... So, is that
yet another new topic? Why should it be so surprising since they are so
very much different in terms of system objectives?

One is for short, known
signals (known modulation if you will) and the other is for long, known
frequency, signals of unknown modulation. That may not be the best
description but it's close enough for now.

A lot more cycles [time] should be necessary with PSR to get the same
reduction of noise as FFT reference filtering.
***FFT has nothing to do with it. It just complicates things a bit if
you go that way.

With a FFT you know everything possible about the signal and with
reference filtering in the frequency domain, all that information is
utilized. That may be why they call the match filter the "optimal"
filter. It may be the absolute best you can do.
***A matched filter is the optimal linear filter for maximizing the
signal to noise ratio (SNR) in the presence of additive noise. FFT has
nothing to do with it.

With PSR you only know or need to know the phase angle. Many lock in
systems simply multiply with a square wave. All the information in
the wave form is tossed with PSR.
***With PSR you generally don't know the phase angle. That's why lock
is something that has to be accomplished with the implementation and not
by the designer in some a priori fashion ... which is what I think is
meant by "know or need to know the phase angle". Perhaps there's a
different intent.

So, it appears you're pondering a *system design* question in addition
to your original question about matched filtering.

The PSR is only of interest now if it was possible to somehow glean a
phase angle, maybe by comparing the reference * signal with the
reference * reference or the signal * signal. If that's not possible
then the phase angle will have to be determined by some kind of
convolution / match filtering.
Do you mean "phase angle" or do you mean "delay"? Well, at least one
can reasonably ask this question in the context of radar or sonar. In
some systems *relative* phase might be used to differentiate between
various physically-separated target elements. But one inch in 50 miles
is rarely of interest on an absolute basis. What *are* you trying to do
in a system context?

Fred
 
On 3/7/2011 12:07 PM, Bret Cahill wrote:
Couldn't a bank be used in the time domain (PSR) when you
don't know the phase angle? It might require a high SNR level.


Bret Cahill
Phase angle is unimportant in a correlator because the reference signal
is "slid along" the input signal with a multiplication and integration
done for each position or time delay. Thus, *all* phases are considered
(as long as the sample rate is high enough) -phase and time delay being
tied together.

Perhaps it would help to consider how this might look in a streaming system.
Samples come into the matched filter / correlator and samples come out
of it in a steady stream. No blocks involved.... and no FFT either.

How does "time domain" get hooked to "PSR" here? That seems an
unfortunate misconception. Granted it's harder to think of PSR in the
frequency domain but I thought we were talking about correlators /
matched filters here. Certainly that's what Jason was talking about.

Indeed, one can implement banks of filters. It's common when there are
large frequency shifts due to Doppler AND relatively long signals with
narrow bandwidth for example. So then you have a matched filter for
each frequency "bin".

Indeed, an FFT is a matched filter of sorts for a sinusoid. Phase is
unimportant again because the FFT will show energy in the Real part, the
Imaginary part or both by detecting the in phase and quadrature
components separately. Instead of "sliding" the sinusoid, the FFT uses
a sin and a cos at the same time. The combination of the result yields
the predominating phase angle over the FFT window. In that sense, it's
phase independent just like a temporal implementation.

Fred
 
How in the world did PSR get into this thread?

It was a stepping stone to using Excel for match filtering.

***But PSR isn't much of anything like matched filtering in terms of
implementation.....
The both use a reference that doesn't correlate much or often with the
noise.

I thought we were
talking about matched filters and whether there were any differences
between time domain implementation and frequency domain implementation..

It's no longer of interest so feel free to ignore it.

***OK.  You're welcome.



OK, I found a description:http://techdoc.kvindesland.no/radio/ymse1/20061216153544735.pdf

Geez.  This looks a lot like a phase-locked loop (PLL) receiver of the
sort that's used, for example, in deep space communications.

The time multiplication step is the heart of PSR and lock in.

***Actually the time multiplication step is a trivial part of it.   The
heart of it is getting the frequency and phase adjusted to get lock.
That's not always an issue with PSR. In some important cases the
reference is inherently in phase with the signal. Phi will certainly
be close enough to zero to be ignored.

OTOH it is _always_ necessary to multiply the signal by some reference
with a known phase angle in either PPL, lock in or PSR.

  In those
applications, the data bandwidth is very low so that the receiver
bandwidth can be very low (thus improving SNR at the output).

Matched filters are most often used in pulse systems like radar and
sonar; although they tend to work better in radar.  There's a ton of
literature on the subject.

PLL receivers tend to work on continuous signals.  There is generally a
"lock" period to get the phase right and the receiver can also "lose lock".

The phase may not always be known in which case it won't work for
precision amplitude measurements.  It may very well be worse than the
noise.

***The phase is never known unless there's a phase reference as in a
suppressed carrier control system and that's mostly used to know the *sign*.
Depends on the situation. Sometimes it's not enough to matter.

The difference seems rather stark to me.

It would be surprising if the two types of reference or "adaptive"
filtering weren't compared before now.

Well, there's nothing adaptive in this conversation yet...  
Match along with Weiner and probably a host of other signal bandwidth
filters are called "adaptive filters." Some would include lock-in and
PSR.

Even noise determination and subtraction is sometimes called "adaptive
filtering" although that might be another example of indiscriminate
use of words.

So, is that
yet another new topic?  Why should it be so surprising since they are so
very much different in terms of system objectives?
Sometimes it's easier to look at every category a thing could fall
under.

One is for short, known
signals (known modulation if you will) and the other is for long, known
frequency, signals of unknown modulation.  That may not be the best
description but it's close enough for now.

A lot more cycles [time] should be necessary with PSR to get the same
reduction of noise as FFT reference filtering.

***FFT has nothing to do with it.  It just complicates things a bit if
you go that way.
You'll need to get a Fourier transform somehow and FFT is the most
efficient way to get it.

With a FFT you know everything possible about the signal and with
reference filtering in the frequency domain, all that information is
utilized.  That may be why they call the match filter the "optimal"
filter.  It may be the absolute best you can do.

***A matched filter is the optimal linear filter for maximizing the
signal to noise ratio (SNR) in the presence of additive noise.  
Looks like we may agree on that..

FFT has
nothing to do with it.

With PSR you only know or need to know the phase angle.  Many lock in
systems simply multiply with a square wave.  All the information in
the wave form is tossed with PSR.

***With PSR you generally don't know the phase angle. That's why lock
is something that has to be accomplished with the implementation and not
by the designer in some a priori fashion ...
Even if true how would that change the fact that PSR doesn't utilize
as much information as match filtering and therefore cannot clean up a
signal in as short a time?

which is what I think is
meant by "know or need to know the phase angle".  Perhaps there's a
different intent.

So, it appears you're pondering a *system design* question in addition
to your original question about matched filtering.

The PSR is only of interest now if it was possible to somehow glean a
phase angle, maybe by comparing the reference * signal with the
reference * reference or the signal * signal.  If that's not possible
then the phase angle will have to be determined by some kind of
convolution / match filtering.

Do you mean "phase angle" or do you mean "delay"?  
Delay would be better since it isn't a simple sine curve. In fact, it
generally won't even be periodic.

Well, at least one
can reasonably ask this question in the context of radar or sonar.  In
some systems *relative* phase might be used to differentiate between
various physically-separated target elements.  But one inch in 50 miles
is rarely of interest on an absolute basis.  What *are* you trying to do
in a system context?
Determine a magnitude of an signal with a SNR of 2 - 20.

If the delay is more than 1.5% of the pulse period and the SNR is over
10, then a filter that don't correct for the delay will cause more
harm than good.

I'd rather have the noise.


Bret Cahill
 
Couldn't a bank be used in the time domain (PSR) when you
don't know the phase angle?  It might require a high SNR level.

Phase angle is unimportant in a correlator because the reference signal
is "slid along" the input signal with a multiplication and integration
done for each position or time delay.  
So you think a bank of correlators would work in PSR as well?

For high precision equal phase angle magnitudes on both sides of the
maximun could be determined and the center of that would be where phi
= zero.

Thus, *all* phases are considered
(as long as the sample rate is high enough) -phase and time delay being
tied together.

Perhaps it would help to consider how this might look in a streaming system.
Samples come into the matched filter / correlator and samples come out
of it in a steady stream.  No blocks involved.... and no FFT either.

How does "time domain" get hooked to "PSR" here?  That seems an
unfortunate misconception.  Granted it's harder to think of PSR in the
frequency domain but I thought we were talking about correlators /
matched filters here.  Certainly that's what Jason was talking about.

Indeed, one can implement banks of filters.  It's common when there are
large frequency shifts due to Doppler AND relatively long signals with
narrow bandwidth for example.  So then you have a matched filter for
each frequency "bin".

Indeed, an FFT is a matched filter of sorts for a sinusoid.  Phase is
unimportant again because the FFT will show energy in the Real part, the
Imaginary  part or both by detecting the in phase and quadrature
components separately.  Instead of "sliding" the sinusoid, the FFT uses
a sin and a cos at the same time.  The combination of the result yields
the predominating phase angle over the FFT window.  In that sense, it's
phase independent just like a temporal implementation.
Earlier my assumption was the "delay" would always be zero and what I
was calling a "matched filter" was really just using the dot product
in the FFT to determine magnitude. That filters the noise very
quickly, much better than PSR.

Now it appears that a delay may make things somewhat more complicated
but apparently a near zero delay can always be found if you have
enough banks.

(I keep imagining some hapless signal running a gauntlet of FFTs
heavily armed with clubs, ready to beat the truth out of the signal.)


Bret Cahill
 
On 3/7/2011 3:05 PM, Bret Cahill wrote:
Now it appears that a delay may make things somewhat more complicated
but apparently a near zero delay can always be found if you have
enough banks.

(I keep imagining some hapless signal running a gauntlet of FFTs
heavily armed with clubs, ready to beat the truth out of the signal.)
LOL

Well, delay isn't a problem in time domain correlation because all
times/delays are accounted for in the correlation/convolution "slide" -
i.e. in the integral over tau as in (t - tau).

And, as I said just a bit ago, delay isn't a problem in the frequency
domain because it's as if one is using in phase and quadrature elements
- although averaged over the temporal window being used. Jerry
mentioned that approach in a time domain context.

I don't comprehend:
"a near zero delay can always be found if you have
enough banks"
I only ken "banks" like this:

1) matched temporal filter banks that are configured to deal with
various frequency shifts - often using temporal expansion/compression to
get the filter characteristic so the reference waveform vs. Doppler
matches. A sometimes simpler way for narrow bandwidth situations is to
simply frequency shift the filter leaving the bandwidth alone.
Delay isn't part of this.....

2) Frequency domain filters that are the FFT of those temporal filters
in (1). [It's this reason that I don't get too hung up on whether the
filtering is done in time or frequency as it should be the same thing
.... as others have said. My only hangup there is in the details of
implementation being done properly.]

I still don't understand what you're trying to do in a system context.
Often that helps the helper. Estimating the amplitude of a signal is an
objective of some system context which brings in all the parameters like
signal duration, bandwidths, frequency shifts, modulation/signal design,
etc. A lot depends on these things re: how to meet that one objective.

Fred
 
On Mar 7, 2:05 pm, Bret Cahill <BretCah...@peoplepc.com> wrote:

That would be easy in Excel.

What about the inverse transform?
I don't know what Excel has to do with it......  Lots of things can be
done with Excel - indeed sometimes to good advantage.

I was using it to get an idea of what kind reduction of noise is
possible with reference filtering in the time domain [phase sensitive
rectification (PSR)] v reference filtering in the frequency domain.
Noise reduction with matched filters is the easiest thing in the
world: Forget about the input signal and copy the reference signature
you used to design the filter itself.

Seriously.

That's one possible method for digital recievers: Use a bank of
matched filters, each filter tuned to one symbol in the code book,
detect which symbol 'best' matches the recieved signal and use
the corresponding symbol downstream.

....
Once that is known and corrected another FFT based reference filter
can reduce the noise in one or two cycles.
MAtched filters are used to detect the presence of known signatures,
not to reduce noise.

....
I don't think it best to consider the reference as having a time
reference - other than it begins and ends.  The time reference is likely
best determined by when you snagged the received signal sequence - the
absolute time of the signal sequence.  Then, the output of the matched
filter would be referenced to that time frame.

Isn't that how radar works?  They keep taking FFTs and dot products
until the correlation spikes?
No. Using matched filters. MFs might just as well be implemented
directly in time domain.

That seems like it would be nearly impossible without computers.
Matched filters are impossible without computers.

Rune
 
On 3/8/2011 8:25 AM, Bret Cahill wrote:
Multiplying a simple sine wave SNR = 1 signal with a reference in
SPICE's FFT seems to reduce a simple sine wave noise by orders of
magnitude, even with large time delays or phase angles between the ref
& signal.
Bret,

This is an unfortunate perspecctive .. "even with large time delays or
phase angles between the ref & signal."

In matched filtering, the reference *has no* absolute time reference
whatsoever. So, there can be no time delay or phase shift *defined*.
This is not to be confused with the relative time frame within the
reference.

Folks here have made this point over and over but it seems to be getting
lost. And, that could be important to your dealing with this.

Fred
 
On 3/8/2011 8:25 AM, Bret Cahill wrote:
If signal and reference have a phase angle or time delay, however, two
errors appear.
Bret,

Well, perhaps you can explain how this can possibly be. Maybe that will
help us understand what you're trying to say.

Fred
 
That would be easy in Excel.

What about the inverse transform?
I don't know what Excel has to do with it......  Lots of things can be
done with Excel - indeed sometimes to good advantage.

I was using it to get an idea of what kind reduction of noise is
possible with reference filtering in the time domain [phase sensitive
rectification (PSR)] v reference filtering in the frequency domain.

Noise reduction with matched filters is the easiest thing in the
world: Forget about the input signal and copy the reference signature
you used to design the filter itself.

Seriously.

That's one possible method for digital recievers: Use a bank of
matched filters, each filter tuned to one symbol in the code book,
detect which symbol 'best' matches the recieved signal and use
the corresponding symbol downstream.

...

Once that is known and corrected another FFT based reference filter
can reduce the noise in one or two cycles.

MAtched filters are used to detect the presence of known signatures,
not to reduce noise.

The goal here is to reduce noise an order of magnitude or more for
precise amplitude determination, not to identify the appearance or
reappearance of a pulse

Multiplying a simple sine wave SNR = 1 signal with a reference in
SPICE's FFT seems to reduce a simple sine wave noise by orders of
magnitude, even with large time delays or phase angles between the ref
& signal.

SPICE is probably just multiplying magnitudes in which case a time
delay or phase angle between the ref and signal isn't an issue.

If, however, both noise & signal have many frequencies, many in the
same bandwidth, simply multiplying magnitudes might not be good
enough.

It would be much better to account for all the information in the
signal and reference including the phase angle of each frequency. A
match filter does this by taking the dot product of of real and
imagnary at each frequency.

The same can be done to attenuate noise _if_ the ref and signal are
synchronized. It's easy to set up a multi frequency signal and noise
on Excel, take the FFT, take the dot product, INV FFT and then AVERAGE
to get a signal magnitude.

If signal and reference have a phase angle or time delay, however, two
errors appear. The phase angle information will be off which will
reduce the ability of the filter to attenuate the noise. It may even
have the effect of amplifying the noise. Even worse, even without
noise, the dot product and inverse FFT -- the magnitude of the signal
-- will drop with the delay between ref and signal.

In that case maybe 4 - 7 FFTs of the reference spaced out for a time
lag of about, say 1% of the signal period, could cover every possible
lag time or phase angle that might appear.


Bret Cahill









but it won't work if the reference isn't
 
On Mar 8, 11:25 am, Bret Cahill <Bret_E_Cah...@yahoo.com> wrote:
Multiplying a simple sine wave SNR = 1 signal with a reference in
SPICE's FFT seems to reduce a simple sine wave noise by orders of
magnitude, even with large time delays or phase angles between the ref
& signal.
As Fred has already pointed out multiple times, there is no "time
delay" associated with matched filtering; the "filtering" action
consists of sliding the template across the (much longer) received
signal and performing an inner product at each time instant. There
will be some time instant where the delay is zero (or less than 0.5
samples, if there is some fractional delay between the reference and
the matched filter input). And, as I pointed out before, a phase
offset between the template and the matched filter input does not
affect the magnitude of the filter's output. If you have access to a
MATLAB-like environment, run this:

x = randn(1024,1);
x_ref = x .* exp(j*2*pi*rand);
loss_dB = 10*log10(abs(sum(x .* conj(x)))/abs(sum(x .* conj(x_ref))))

Executing the above on my machine gave a magnitude loss of 4.0105e-015
dB, which is negligible error owing to the finite precision used
throughout the calculations. A constant phase offset will not cause
the matched filter output's magnitude to vary. However, a frequency
offset will:

x_ref = x .* exp(j*2*pi*(0:1023)./1024).';
loss_dB = 10*log10(abs(sum(x .* conj(x)))/abs(sum(x .* conj(x_ref))))

The frequency offset caused a loss in the cross-correlation's
magnitude of 15.6 dB. Since what you're trying to do is so unclear,
I'm not sure if there is just some terminology confusion or if there
is an actual bug in your implementation.

Jason
 
Multiplying a simple sine wave SNR = 1 signal with a reference in
SPICE's FFT seems to reduce a simple sine wave noise by orders of
magnitude, even with large time delays or phase angles between the ref
& signal.

As Fred has already pointed out multiple times, there is no "time
delay" associated with matched filtering; the "filtering" action
consists of sliding the template across the (much longer) received
signal and performing an inner product at each time instant. There
will be some time instant where the delay is zero (or less than 0.5
samples, if there is some fractional delay between the reference and
the matched filter input). And, as I pointed out before, a phase
offset between the template and the matched filter input does not
affect the magnitude of the filter's output.
So the process of identifying where the pulse has a zero time lag or
zero phase angle with the signal is included in match filtering.

If you have access to a
MATLAB-like environment, run this:

 x = randn(1024,1);
 x_ref = x .* exp(j*2*pi*rand);
 loss_dB = 10*log10(abs(sum(x .* conj(x)))/abs(sum(x .* conj(x_ref))))

Executing the above on my machine gave a magnitude loss of 4.0105e-015
dB, which is negligible error owing to the finite precision used
throughout the calculations.
What if there happens to be some correlation between noise and pulse
at maximum correlation?

You may still be able to identify the time of the pulse but the
amplitude might not be precisely known.

A constant phase offset will not cause
the matched filter output's magnitude to vary. However, a frequency
offset will:

 x_ref = x .* exp(j*2*pi*(0:1023)./1024).';
 loss_dB = 10*log10(abs(sum(x .* conj(x)))/abs(sum(x .* conj(x_ref))))

The frequency offset caused a loss in the cross-correlation's
magnitude of 15.6 dB. Since what you're trying to do is so unclear,
I'm not sure if there is just some terminology confusion or if there
is an actual bug in your implementation.
See if this sounds right:

Match filtering on Excel requires taking FFTs of the signal at a high
enough frequency to not miss the pulse. A dot product with the
reference is taken for each point. When a peak appears you found the
pulse.

Originally I figured I'd know where the peak was so all I needed to do
was the dot product at the peak to get the amplitude.

Now it looks like the signal might not always be exactly synchronous
with the ref. but that shouldn't be a problem if match filtering can
in fact find the maximum.


Bret Cahill
 
If signal and reference have a phase angle or time delay, however, two
errors appear.

Well, perhaps you can explain how this can possibly be.  
Maybe back up a little:

If the signal and reference are synchronous, my original assumption,
then I don't really need a match filter. I am already at maximum
correlation.

All I need to do is take one FFT of the ref and one of the signal and
then take the dot product to get something representing the magnitude
of the signal. That can be modeled on Excel, if not SPICE.

In some situations, however, the reference will have the same
frequency and waveform as the signal but it won't be exactly
synchronous. There will be a delay or phase angle between the two.

This could throw the magnitude off even worse than no filter at all.

In that case match filtering may become necessary to find the maximum
magnitude.

Match filtering is impossible on SPICE and it would be time consuming
on Excel but as long as the correlations were done fast enough then
match filtering should either provide a phase angle to correct the
reference or give a give a good magnitude directly.


Bret Cahill





Bret Cahill
 
On Mar 8, 3:21 pm, Bret Cahill <Bret_E_Cah...@yahoo.com> wrote:
What if there happens to be some correlation between noise and pulse
at maximum correlation?

You may still be able to identify the time of the pulse but the
amplitude might not be precisely known.
Exactly. Such is life in a noisy world.

See if this sounds right:

Match filtering on Excel requires taking FFTs of the signal at a high
enough frequency to not miss the pulse.  A dot product with the
reference is taken for each point.  When a peak appears you found the
pulse.
Matched filtering does not require taking any FFTs. Matched filtering
is just applying a linear filter with a special shape to a signal,
nothing more. Since linear filtering is equivalent to convolution,
there are fast convolution techniques that involve using FFTs (I
assume this is related to your concept of frequency-domain filtering),
but FFTs are not required. In the time domain, yes, at each time
instant you calculate a dot product between the filter taps and a
window of samples from the signal. For pulse detection applications,
the idea is that when the template lines up with the pulse, you get a
peak of large enough amplitude to detect reliably.

Jason
 
What if there happens to be some correlation between noise and pulse
at maximum correlation?

You may still be able to identify the time of the pulse but the
amplitude might not be precisely known.

Exactly. Such is life in a noisy world.
The best possible will have to do.

See if this sounds right:

Match filtering on Excel requires taking FFTs of the signal at a high
enough frequency to not miss the pulse.  A dot product with the
reference is taken for each point.  When a peak appears you found the
pulse.

Matched filtering does not require taking any FFTs. Matched filtering
is just applying a linear filter with a special shape to a signal,
nothing more.
Would the CORREL function on Excel work? Just slide the pulse in the
reference column past the signal checking the CORREL output until it
spikes.

That would be much easier than taking FFTs.

Since linear filtering is equivalent to convolution,
there are fast convolution techniques that involve using FFTs (I
assume this is related to your concept of frequency-domain filtering),
but FFTs are not required. In the time domain,
"Time domain" or "frequency domain?"

yes, at each time
instant you calculate a dot product between the filter taps and a
window of samples from the signal. For pulse detection applications,
the idea is that when the template lines up with the pulse, you get a
peak of large enough amplitude to detect reliably.
Thanks again.


Bret Cahill
 
On 3/8/2011 12:52 PM, Bret Cahill wrote:
If signal and reference have a phase angle or time delay, however, two
errors appear.

Well, perhaps you can explain how this can possibly be.

Maybe back up a little:

If the signal and reference are synchronous,
***What does that mean? that they are "synchronous"???

my original assumption,
then I don't really need a match filter. I am already at maximum
correlation.
***Using what method to get "maximum correlation"? This is most unclear.

All I need to do is take one FFT of the ref and one of the signal and
then take the dot product to get something representing the magnitude
of the signal. That can be modeled on Excel, if not SPICE.
***However it may be modeled, that sounds like a matched filter because
you keep using the term "ref". What else could it be? What *is* the "ref"?
In some situations, however, the reference will have the same
frequency and waveform as the signal but it won't be exactly
synchronous.

***In any case that I know of, the "reference" won't be "synchronous"
with the signal as I have explained many times now. You just seem to
keep ignoring that so there must be a huge misunderstanding. I really
don't know what you mean by "synchronous".

There will be a delay or phase angle between the two.

***How is that possible? It must have something to do with your
implementation and the FFT thing described above would seem to deny such
a possibility as well.
This could throw the magnitude off even worse than no filter at all.

In that case match filtering may become necessary to find the maximum
magnitude.
***If this isn't matched filtering then what is it? Can you describe
what you're doing please?
Match filtering is impossible on SPICE and it would be time consuming
on Excel but as long as the correlations were done fast enough then
match filtering should either provide a phase angle to correct the
reference or give a give a good magnitude directly.
***You don't need a phase angle for a matched filter because *all* phase
angles, really delays, are built in. You seem to be ignoring this
simple fact. So, the question is: why?

I get the sense that you're somehow "involved" with an implementation
(thus the comments about Spice and Excel) and this is leading you astray
regarding the underlying mathematics .. if you will.

It's well past due time to get the terminology straight.

Fred
 
On Tue, 8 Mar 2011 12:52:21 -0800 (PST), Bret Cahill
<Bret_E_Cahill@yahoo.com> wrote:

If signal and reference have a phase angle or time delay, however, two
errors appear.

Well, perhaps you can explain how this can possibly be. =A0

Maybe back up a little:

If the signal and reference are synchronous, my original assumption,
then I don't really need a match filter. I am already at maximum
correlation.

All I need to do is take one FFT of the ref and one of the signal and
then take the dot product to get something representing the magnitude
of the signal. That can be modeled on Excel, if not SPICE.
If the signal and reference are synchronous, an FFT is a
total waste of time. You have only one frequency involved,
so all you need is a lock-in. That's essentially one bin of
an FFT, with no contraints on the size of the sample
frame... you can use an exponential (RC-type) average and
get the same results as a real Olde-Tyme hardware lock-in.

Better yet, there is no issue of spectral splatter, since
the effective one-line "FFT" is precisely tuned to the
reference. So, no need for window functions.

You just need sin and cos versions of the reference,
multiply the signal by each, low-pass filter, and you have
effectively the same as the real and imaginary components of
that bin of the FFT.

In some situations, however, the reference will have the same
frequency and waveform as the signal but it won't be exactly
synchronous. There will be a delay or phase angle between the two.

This could throw the magnitude off even worse than no filter at all.
No. A delay or phase angle has no effect on the results if
you have used sin and cos versions of the reference... the
final magnitude will be the same.

In a prior post you were concerned about noise near to the
reference/signal frequency. The only way to remove that is
by averaging a longer time window. (Larger TC on the
effective lock-in filters.) The noise goes down as the
square root of the averaging time... 3 dB improvement for
each doubling of the time. You rapidly get to a point where
the cost of that 3 dB is prohibitive in terms of how long
you want to wait.

I don't think matched filters are going to help you here.
The above scheme is working right at the heart of the issue,
which is that if you have random noise near the signal
frequency, the only way to be sure of what is signal and
what is noise is by longer observation. There is no magic
bullet.

Best regards,


Bob Masta

DAQARTA v6.00
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
Frequency Counter, FREE Signal Generator
Pitch Track, Pitch-to-MIDI
Science with your sound card!
 
If signal and reference have a phase angle or time delay, however, two
errors appear.

Well, perhaps you can explain how this can possibly be. =A0

Maybe back up a little:

If the signal and reference are synchronous, my original assumption,
then I don't really need a match filter.  I am already at maximum
correlation.

All I need to do is take one FFT of the ref and one of the signal and
then take the dot product to get something representing the magnitude
of the signal.  That can be modeled on Excel, if not SPICE.

If the signal and reference are synchronous, an FFT is a
total waste of time. You have only one frequency involved,
so all you need is a lock-in.  
This brings up a question that hasn't been easy to find with the
[probably wrong] key words. If a signal has a complicated waveform
like that of a double reed instrument, i.e., an oboe, is it faster and
easier to reference filter than a simple sine wave?

Instead of just one, a lot of correlations can be extracted from in
one fundamental signal cycle. It seems like more frequencies => less
opportunity for the noise frequencies to to correlate.

If this is true then there should be a lot of literature on signals
that are deliberately designed to have some "personality" so that they
can be quickly filtered.

Anyway, to clear things up, there are a lot of frequencies in both the
signal and noise, some of both in the same band. To keep things
simple I have often used just one or 2 sine waves in SPICE for both
noise and signal, but that was only to try to get the basics down.
Later on I'll get fancy and string together dozens of voltages for
both signal and noise and hope it doesn't freeze up the application.
Excel is easier. Just make up a polynomial and every frequency bin
has something in it.

That's essentially one bin of
an FFT, with no contraints on the size of the sample
frame... you can use an exponential (RC-type) average and
get the same results as a real Olde-Tyme hardware lock-in.

Better yet, there is no issue of spectral splatter, since
the effective one-line "FFT" is precisely tuned to the
reference.  So, no need for window functions.

You just need sin and cos versions of the reference,
multiply the signal by each, low-pass filter, and you have
effectively the same as the real and imaginary components of
that bin of the FFT.

In some situations, however, the reference will have the same
frequency and waveform as the signal but it won't be exactly
synchronous.  There will be a delay or phase angle between the two.

This could throw the magnitude off even worse than no filter at all.

No.  A delay or phase angle has no effect on the results if
you have used sin and cos versions of the reference... the
final magnitude will be the same.
If the phase angle between two complicated waveforms is unknown but
generally below, say, 20 degrees, could that approach be used in a FFT
based filter?

It seems like the higher frequencies would be further and further
off. By the time you got to bin 18 they might have gone full circle.

In a prior post you were concerned about noise near to the
reference/signal frequency.  The only way to remove that is
by averaging a longer time window. (Larger TC on the
effective lock-in filters.)  The noise goes down as the
square root of the averaging time... 3 dB improvement for
each doubling of the time.  You rapidly get to a point where
the cost of that 3 dB is prohibitive in terms of how long
you want to wait.

I don't think matched filters are going to help you here.
The above scheme is working right at the heart of the issue,
which is that if you have random noise near the signal
frequency, the only way to be sure of what is signal and
what is noise is by longer observation.  There is no magic
bullet.
Thanks.


Bret Cahill



Best regards,

Bob Masta

              DAQARTA  v6.00
   Data AcQuisition And Real-Time Analysis
             www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
    Frequency Counter, FREE Signal Generator
           Pitch Track, Pitch-to-MIDI
          Science with your sound card!
 
In some situations, however, the reference will have the same
frequency and waveform as the signal but it won't be exactly
synchronous.  There will be a delay or phase angle between the two.

This could throw the magnitude off even worse than no filter at all.

No.  A delay or phase angle has no effect on the results if
you have used sin and cos versions of the reference...  the
final magnitude will be the same.

If the phase angle between two complicated waveforms is unknown but
generally below, say, 20 degrees, could that approach be used in a FFT
based filter?
A time lag or phase shift in the reference doesn't seem to matter one
bit using IMPRODUCT of the reference and signal in Excel's FFT. This
is true with noise which it filters quite well in just one cycle.

The IMPRODUCT function multiplies complex numbers and in the FFT and
it may preserve/drop information lost/acquired in a simple dot
product.

It's pretty interesting to see it work. A lot of people probably go
into the frequency domain and never come out.


Bret Cahill
 
On 3/10/2011 7:52 AM, Bret Cahill wrote:

A time lag or phase shift in the reference doesn't seem to matter one
bit using IMPRODUCT of the reference and signal in Excel's FFT. This
is true with noise which it filters quite well in just one cycle.

Sounds very familiar. Does this mean we're getting somewhere? One
learns best by hands-on, eh?

Now you're doing a complex multiply of complex frequency sequences,
which is equivalent to a time domain circular convolution, and seem
interested that the results are what we tried to tell you they would be.

Did you compute an ABS after the multiply?
And, really, using IMPRODUCT in frequency *should* generate different
complex results with different alignments of the reference or of the
signal in time. But, the magnitudes or ABS at each frequency should be
the same from one trial to the next. Is that what you're seeing?

Fred
 

Welcome to EDABoard.com

Sponsor

Back
Top