low pass digital filter on a fixed point microcontroller

Jerry Avins wrote: (snip)

I was wondering about that, too. With a PLL it would on the average be right, but I believe that is close enough.

Otherwise, see my previous post for the question of finite vs. infinite interval.

-- glen

Reply to
glen herrmannsfeldt
Loading thread data ...

Yes. First paragraph of the post you replied to and quoted: "in order to capture its essence". Right after "Jerry Avins wrote:".

--
Guy Macon
Reply to
Guy Macon

You don't consider an output taht is a flat line after some powerups and not after otherpowerups to be a problem? With no output at all (which is what you get when you sample a sine wave at Nyquist and every sample hit a zero crossing) you lose both phase and amplitude information.

--
Guy Macon
Reply to
Guy Macon

I'd call that a near miss: Imaginge a signal (for the sake of argument, a perfect sine wave will do just fine). Now, as we sample exactly at twice the frequency of that sine wave, you have too little information. That's because you don't know the phase of the signal relative to your sample points and thus don't know the amplitude of that signal. To further explain this: as you don't know the phase, you can't tell if the, say, 1mV you're measuring as amplitude is a peak value or some value near zero crossing of that sine wave. Worst case you'd be measuring exactly at zero crossings and thus deduct that there is no signal even though the line carries several Watts of RF. So, exactly twice the highest signal frequency clearly is not high enough for sampling, you'd definitely need more. DC is no problem there as the samples would change their sign anyways, with signal frequencies equal to sample frequenca one would get some constant DC value, but we already agree on twice the highest signal frequency anyways...

HTH, Florian

Reply to
Florian E. Teply

Umm, well, maybe i'm thick as well, but wouldn't that basically limit the measurement to the device that's generating the signal as well? Apart from me seeing no point in measuring a signal i already know (as i created it here and now in the first place), even sampling at exactly twice the signal frequency (by using the same clock source as the generator) would do me no good in a two-devices-connected-and-synced-by- cabling setup as the phase correlation of sampling device and source would be highly dependent on the cabling used. Even swapping one cable for another could render the presentation of the highes signal frequency useless unless both cables have *exactly the same length*. So, in theory this would be possible, but in the real world, it won't.

Just my 2 cents, Florian

Reply to
Florian E. Teply

Nicely put!

Reply to
Philip Martel

Here's a few more pennies:

Signals travel on cables around 1.5 to 2 nanoseconds/ft. (1 ns/ft in free space.) Audio samplers generally have enough phase jitter and the signals themselves have small enough slope so that a couple of inches of cable won't affect matters much. (If a 100 KHz sine crosses zero at t=T, what fraction of its peak value occurs at t=(T+100 ns?)

Sampling clocks synchronized to the sampled signal are used in testing labs. The aim there is characterizing the sampler, not the signal.

Jerry

--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply to
Jerry Avins

Oops*! I'm sure you're right, even though I can't track the thread back.

Jerry _________________________________

  • I actually prefer the dutch spelling: oeps.
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply to
Jerry Avins

I didn't claim it's high enough to capture the signal. I claimed it's high enough to avoid aliasing. Consider: a signal at fs/2 + delta aliases to fs/2 - delta. Where is the alias when delta is zero?

However large delta is, you need to sample for a time in the order of

1/delta. How long is that when delta is zero?

Jerry

--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply to
Jerry Avins

Well, i was thinking a tad more like RF, say 30MHz, as that's my domain. But to elaborate on your example, 100 ns is 1/100 period of a 100kHz sine wave, sin(2*pi/100)=0.001 roughly, which is 1 LSB at 10 Bit A/D resolution. It would be worse at higher signal frequencies and/or resolutions of course.

Haven't thought of that.

Thanks for your pocket change ;-)

Florian

Reply to
Florian E. Teply

That case can't arise. the only ways to sample at exactly twice the frequency being sampled are on paper (where any conditions can be assumed) by phase locking the sampler to the signal with absolutely no residual FM, or by deriving signal and sampling clock from a common source. None of this has much do do with reality.

Consider a system sampling at 8 KHz. According to purists, a signal at

3,999.999 Hz is well accommodated, while one at 4,000.001 (or even 4,000.000) is not. Math may work that way, but not real things.

Jerry

--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply to
Jerry Avins

yeah, i guess it's a problem, but it's still this phase related problem. if you hit the Nyquist sine wave at the zero crossings, don't think of the aliasing as a new frequency, it's still a sinusoidal component at Nyquist that is aliased to one have zero- amplitude. so like the problem i outlined, sampling

x(t) =3D (1/cos(theta)) * cos(w0*t + theta)

where

w0 =3D 2*pi*(Fs/2)

and

x[n] =3D x(n/Fs).

what happens, is that amplitude information is lost because of phase. set theta to pi (i guess you have to do something about the 1/ cos(theta) amplitude), but you get the same thing as what you are describing.

r b-j

Reply to
robert bristow-johnson

On a related topic, I have to do something I have never done (Nooooo!) I need to collect amplitude and phase and represent it as a complex number. It is a fixed frequency (SONAR app -- would love a chirp but can't do it cheaply). So, I need to produce samples Scos(wt) and Ssin(wt). Do I use an analog multiplier before sampling or sample then digital multiply?

Would I use a very high oversampling and multiplying or enough above Nyquist to be safe? I use a very high Q band pass to isolate the signal.

-- Charlie Springer

Reply to
Charlie Springer

Please start another thread for this!

Depending on how much time you want to spend doing specialized hardware to save pennies on the processor vs. spending pennies on the processor to save engineering time, you can go either way.

For moderate volumes you'll save money by using a processor and sampling over Nyquist. One convenient way to get quadrature data is to sample at

4x the carrier; then your inphase data is just [1 0 -1 0 ...] * input, and your quadrature data is just [0 1 0 -1 ...] * input.

When everything else is handed to me on a platter I like to sample about as fast as the ADC will go, and average a lot. This allows me to minimize the ADC front end noise by averaging. Sometimes you can even get more useful bits out of the data this way than the ADC claims to have.

Oversample enough, and you can relax your bandwidth requirements on your bandpass filter, too.

--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

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.