anti-aliasing

M

Michael A. Terrell

Jan 1, 1970
0
John said:
You think rhat my web site is a personal fantasy, that nobody actually
buys the stuff?

Lately we're selling a lot of tach/overspeed and thermocouple stuff
into Russia, for the pipeline business. They're ramping us fast and
are rolling in money. They pay us in advance, by bank transfer, in
dollars. Think we should charge euros?

What do you do, Fred?

John


Makes a fool of himself on Usenet. Not much money in it, but he's
VERY good at it.


--
Service to my country? Been there, Done that, and I've got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
 
C

Charlie Edmondson

Jan 1, 1970
0
John said:
If you treat each sample event as an impulse, there is probably an
optimum resulting spectrum, and a corresponding time-between-samples
scatter algorithm that may not be just bounded random delay.

Some really smart person should work this out.

John
Ok, John,
So, you have a best possible sample rate of 12Ksamples. You want to get
1000 samples to work with, but you don't want a single harmonic to give
you false results. Instead of just a random delay, use some set delays
of known frequency to give you a reasonable spread, say 8us, 11us, 14us,
8us, 11us, 14us. Now, to get your 1K samples it will take a little
longer, but now you have three data sets you can compare to see if there
are any harmonic effects going on. If they don't agree by some
reasonable value, resample say at 9us, 11us, 16us and compare all six...

So, your BIST takes .4s instead of .2, but only if harmonic effects are
noted...

Charlie
 
C

Charlie Edmondson

Jan 1, 1970
0
Charlie said:
Ok, John,
So, you have a best possible sample rate of 12Ksamples. You want to get
1000 samples to work with, but you don't want a single harmonic to give
you false results. Instead of just a random delay, use some set delays
of known frequency to give you a reasonable spread, say 8us, 11us, 14us,
8us, 11us, 14us. Now, to get your 1K samples it will take a little
longer, but now you have three data sets you can compare to see if there
are any harmonic effects going on. If they don't agree by some
reasonable value, resample say at 9us, 11us, 16us and compare all six...

So, your BIST takes .4s instead of .2, but only if harmonic effects are
noted...

Charlie

Ok, off by a factor 10, 80us, 110us, 140us, etc....

Charlie
 
F

Fred Bloggs

Jan 1, 1970
0
John said:
You think rhat my web site is a personal fantasy, that nobody actually
buys the stuff?

Lately we're selling a lot of tach/overspeed and thermocouple stuff
into Russia, for the pipeline business. They're ramping us fast and
are rolling in money. They pay us in advance, by bank transfer, in
dollars. Think we should charge euros?

What do you do, Fred?

John

I'm not at all interested in your dull and boring life and enterprises.
 
J

Jim Thompson

Jan 1, 1970
0
I'm not at all interested in your dull and boring life and enterprises.

The green-eyed monster keeps on ranting. Please shut up!

...Jim Thompson
 
J

John Larkin

Jan 1, 1970
0
I'm not at all interested in your dull and boring life and enterprises.

Well, it amuses me.

So, what are you interested in?

John
 
J

Joerg

Jan 1, 1970
0
John said:
If you treat each sample event as an impulse, there is probably an
optimum resulting spectrum, and a corresponding time-between-samples
scatter algorithm that may not be just bounded random delay.

Some really smart person should work this out.

Didn't have time to read the whole thread but at first glance it looks
like this one hadn't come up:

I usually try to figure this stuff out in time domain. Since you know
it's a sine wave you could find out where it crosses zero, or some other
DC level if the data indicates it's all above or below zero. The data
values of each sample pair that straddles zero (or a selected DC level)
will indicated where exactly the zero crossing happened on the timeline
between these two samples. Now monitor three consecutive crossings and
you have the frequency plus the DC offset.
 
J

John Larkin

Jan 1, 1970
0
Didn't have time to read the whole thread but at first glance it looks
like this one hadn't come up:

I usually try to figure this stuff out in time domain. Since you know
it's a sine wave

It's *supposed* to be a sine wave, but that's one of the things I'm
trying to verify. It should have a predicted average-abs value and a
small averaged (offset) value.
you could find out where it crosses zero, or some other
DC level if the data indicates it's all above or below zero. The data
values of each sample pair that straddles zero (or a selected DC level)
will indicated where exactly the zero crossing happened on the timeline
between these two samples. Now monitor three consecutive crossings and
you have the frequency plus the DC offset.

The adc sample rate may be above or below the potentially unknown
signal frequency, so I can't measure crossings to any useful accuracy.

John
 
M

Michael A. Terrell

Jan 1, 1970
0
Jim said:
The green-eyed monster keeps on ranting. Please shut up!


He should change his handle to J. Fred Muggs.


--
Service to my country? Been there, Done that, and I've got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
 
J

John Devereux

Jan 1, 1970
0
John Larkin said:
It's *supposed* to be a sine wave, but that's one of the things I'm
trying to verify. It should have a predicted average-abs value and a
small averaged (offset) value.


The adc sample rate may be above or below the potentially unknown
signal frequency, so I can't measure crossings to any useful accuracy.

The random sampling interval idea has to be the best - provided you
can accept the small amount of "noise" in your results. I don't know
how to *prove* it's the best though! I suppose anything less "random"
could end up aliasing something, if the input is unknown.

I used a similar trick for measuring duty cycle. I realised you dont
need to track the signal and precisely time each edge - just sample
when you can and average. (My input was already random so aliasing was
not much problem).
 
N

Norman Yarvin

Jan 1, 1970
0
John Larkin said:
If you treat each sample event as an impulse, there is probably an
optimum resulting spectrum, and a corresponding time-between-samples
scatter algorithm that may not be just bounded random delay.

Some really smart person should work this out.

But why, when there are computers which will do it for us? Just program
up a pseudo-random delay which ranges between 1 and 3 times the minimum
possible delay, and simulate it against every possible sine wave
frequency you can generate. It'll probably work; and if it doesn't,
you'll know. Yeah, it might take an hour or two of simulation time, but
so what?

(Things to watch out for are:

1) quantization in the pseudo-random value -- if the clock rate
of whatever circuit tells the ADC to start taking a sample is 1
MHz, and your sine wave is 2 MHz, you'll have aliasing no matter
what you try; and

2) adding the random delay to a fixed, periodic start time. It's
tempting to divide the whole interval of time into 1000
subintervals, and put a random point on each -- but then, since
the points can't be too close to each other, you've introduced
some sort of periodicity, which might be problematic. Better to
just repeatedly compute a random delay and add it to the current
time, to get the next time to sample, and stop when you've
collected 1000 samples, rather than stopping at a prescribed end
time.)
 
F

foobar

Jan 1, 1970
0
Suppose one (actually, me) were firing an adc at some fixed rate,
ballpark 12 KHz in this case, and the input to the adc was a sine wave
of fixed but unknown frequency. The adc will take a bunch of samples,
ballpark 1000 maybe, and I want to compute the mean (ie, dc value) and
the mean of the abs value of the samples (ie, the ac value). That
works, but sometimes the input frequency aliases against the sample
rate and messes up the data, like gives a big average dc value when
there's really none there.

(This is not a Nyquist issue; the sample rate may be above or below
the sinewave frequency.)

So maybe I can fuzz up the sample rate so that it can't alias against
any constant sinewave frequency.

I could add a pseudo-random delay after every adc sample shot; but the
mean sample rate wouldn't change a lot. Or I could add successive
delays, essentially sweeping the sample rate down.

Any ideas?

John

Is an FFT (or a few) out of the question?

--Mac
 
J

John Larkin

Jan 1, 1970
0
Is an FFT (or a few) out of the question?

--Mac

Computationally, yes; I haven't the resources. But what good would it
do? Since the signal frequency may be above or below the sample rate,
the spectrum is hopelessly mutilated and folded.

John
 
M

Martin Brown

Jan 1, 1970
0
That will stop aliassing from generating very unfortunate all top of
peaks samples in the worst case scenaro where the sinewave has an
exact number of cycles between adc samples. I'd be inclined to use a
small pseudorandom delay - frequency sweeping could give you other
alias related artefacts.

But it won't help if the frequency is so low that you only get a small
number and a half cycles of sine wave in your 1000 sample buffer. You
have to also make sure the sums are computed over an integral number
of whole cycles of the captured waveform. And it sounds like you know
it is a sine wave source - essentially noise free.

Min, max and mdeian might be an alternative way of handling the data.
Min, max & median should give you a better handle on peak to peak
amplitude and symmetry of the waveform than the rectified average.
Say, 2 KHz to 1 MHz. The flat-out sample rate is 12.4 KHz (software
loop, bit-banging a 12-bit serial ADC) which I can slow down on a
per-sample basis, randomly or swept or whatever. I usually take about
1000 samples and average the mean and the software-rectified mean.

It might be easier to low pass filter and rectify with low pass filter
in analogue with a slow ADC on the outputs.

Regards,
Martin Brown
 
J

Joerg

Jan 1, 1970
0
John said:
Computationally, yes; I haven't the resources. But what good would it
do? Since the signal frequency may be above or below the sample rate,
the spectrum is hopelessly mutilated and folded.

Looks like a "fuzz up and average long enough" situation then.
 
F

foobar

Jan 1, 1970
0
Computationally, yes; I haven't the resources. But what good would it
do? Since the signal frequency may be above or below the sample rate,
the spectrum is hopelessly mutilated and folded.

John

Well, here's what I'm thinking. Since you can't do it anyway, I'm not
developing it very fully or carefully.

The spectrum is not hopelessly mutilated and folded. If the input is
a sine wave, then there will still be a peak in the frequency domain.
You just won't know how many times it has been aliased around. That's why
you would perhaps want to do two FFT's with different sample rates.

If you have a distinct peak away from DC, then you know you are not
aliased to DC, so you can use the height of the peak and the height of
the DC bin to get your signal amplitude and DC offset, respectively. If
you don't have a peak away from DC, then you know you are either aliased
to DC or there is a fault in the signal synthesis. A second FFT with a
strategically chosen sample rate will resolve the ambiguity.

There's more to it than this. You wouldn't want to use ONLY the height of
the highest bin, you'd want to use the height of the highest bin plus the
heights of adjacent bins. And you may not want to ONLY use the DC bin, but
the first two bins. Etc., etc.

The other idea I had was to sweep the sample rate linearly. In FFT land,
that would smear the signal, and allow you to estimate RMS regardless of
aliasing, perhaps. I haven't really thought it through.

Oh well. Have fun. ;-)

--Mac
 
Top