Filtering In Frequency Domain v Time Domain

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.

That may be the problem.

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

Reply to
Bret Cahill
Loading thread data ...

***But PSR isn't much of anything like matched filtering in terms of implementation.....
***OK. You're welcome.

description:

formatting link

***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.
***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*.

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?

***FFT has nothing to do with it. It just complicates things a bit if you go that way.
***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 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.

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

Reply to
Fred Marshall

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

Reply to
Fred Marshall

The both use a reference that doesn't correlate much or often with the noise.

.
061216153544735.pdf

he

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.

y a

ock".

n*.

Depends on the situation. Sometimes it's not enough to matter.

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.

o

Sometimes it's easier to look at every category a thing could fall under.

n

You'll need to get a Fourier transform somehow and FFT is the most efficient way to get it.

Looks like we may agree on that..

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?

Delay would be better since it isn't a simple sine curve. In fact, it generally won't even be periodic.

o

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

Reply to
Bret Cahill

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 =3D zero.

em.

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

Reply to
Bret Cahill

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

Reply to
Fred Marshall

e

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.

...

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

...

ely

d

No. Using matched filters. MFs might just as well be implemented directly in time domain.

Matched filters are impossible without computers.

Rune

Reply to
Rune Allnor

be

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 =3D 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

Reply to
Bret Cahill

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

Reply to
Fred Marshall

Bret,

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

Fred

Reply to
Fred Marshall

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 =3D randn(1024,1); x_ref =3D x .* exp(j*2*pi*rand); loss_dB =3D 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 =3D x .* exp(j*2*pi*(0:1023)./1024).'; loss_dB =3D 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

Reply to
Jason

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.

)

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.

)

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

Reply to
Bret Cahill

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

Reply to
Bret Cahill

Exactly. Such is life in a noisy world.

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

Reply to
Jason

The best possible will have to do.

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.

"Time domain" or "frequency domain?"

Thanks again.

Bret Cahill

Reply to
Bret Cahill

***What does that mean? that they are "synchronous"???

my original assumption,

***Using what method to get "maximum correlation"? This is most unclear.
***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 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.
***If this isn't matched filtering then what is it? Can you describe what you're doing please?
***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

Reply to
Fred Marshall

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.

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

formatting link
Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, FREE Signal Generator Pitch Track, Pitch-to-MIDI Science with your sound card!

Reply to
Bob Masta

wo

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 =3D> 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.

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.

Thanks.

Bret Cahill

Reply to
Bret Cahill

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

Reply to
Bret Cahill

on.

20061216153544735.pdf

the

he

of

lly a

lock".

he

ign*.

Correction. Adaptive filters have a transfer function that varies with time.

Weiner filters are not adaptive.

so

own

t
f

in

k
t

on

le

n

es

do

Reply to
Bret Cahill

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.