DSPRelated.com
Forums

decimation and resolution

Started by alb October 31, 2014
Hi Robert,

robert bristow-johnson <rbj@audioimagination.com> wrote:
[]
>> Ok, so there's no 'Nyquist frequency' violation if we are undersampling >> information, no aliasing effect that needs to be taken into account, is >> that correct? >> > > uhm, i think you mean "oversampling". "undersampling" means that your > sample rate is not high enough and that Nyquist is below the signal > bandwidth. "oversampling" means that your sample rate is higher than > absolutely necessary and there is a gap of empty band (or stuff you > don't care about) between the top bandedge and Nyquist.
I did mean 'undersampling'. The useful signal is around 1.2Hz and we have a table of values (a.k.a. profile) to be executed at 3KHz. Yet the position is known with a 25KHz rate. So the encoder position is 'undersampled' w.r.t. the control loop and if there's noise it can be injected right where the signal is. Now another question I have is about the bandwidth of my control loop. The simple fact that I'm supposed to drive it at 3 KHz, does it mean the loop bandwidth is 3 KHz? I don't really see the connection.
> the definition of Nyquist frequency i am using is Fs/2 . some people > (even O&S, which is a damn shame), might define Nyquist as the bandwidth > of the continuous-time signal being sampled.
I follow the same definition as you and I'm aware of the confusion! Is O&S Oppenheim and Schafer? Al
On Mon, 03 Nov 2014 09:50:57 +0000, alb wrote:

> Hi Tim, > > Tim Wescott <tim@seemywebsite.com> wrote: > [] >>> That's very nice! So if I understood you correctly what I'm doing with >>> undersampling is getting the noise density above my sampling frequency >>> and aliasing it. That's what I thought in the first place. >> >> I was being sarcastic and thought you'd pick it up. > > I did pick up your sarcasm indeed, but I failed to emphasize it enough > in my reply. The /best/ thing about this whole story is that now I have > my microvibration environment on top of my set of bldc motors and > undersampling may simply be a receipt for failure! > >> As a concrete example, if you're sampling at 8kHz and you've got >> significant noise at 8002Hz, then after sampling that noise will appear >> at 2Hz. 2Hz is probably well within your control loop's bandwidth, so >> your controller will dutifully make sure that the 2Hz signal is >> eliminated from the position feedback -- by making the assembly flap >> around at 2Hz. >> >> This is NOT a problem of the control loop itself: it is an issue with >> the control loop, the sampling, AND the noise. > > Meaning, in order for the control loop to work properly, signal *must* > be treated to avoid issues. > > [] >>>> At this point you ARE decimating, and it may be worthwhile to >>>> consider some very judicious filtering. About the only kind that I'd >>>> contemplate is a filter that decimates by N and averages (or sums) by >>>> N -- you end up with a comb filter with nulls at all harmonics of the >>>> sampling rate (so it totally undermines any noise aliasing), at the >>>> best possible phase shift to attenuation ratio for anything that may >>>> alias down. >>> >>> I'm sorry but I think I lost you here. I understood that noise can be >>> aliased down around DC where my signal is (~1.2Hz) but I haven't >>> understood how the comb filter may undermine aliasing. >> >> If you take my 8kHz sampling example above, an average-and-decimate >> filter will have a frequency response of sinc(pi*f/8000Hz). Its >> response will be 1 at DC, nearly 1 at 2Hz, zero at 8kHz, and about >> 0.00025 at 8002Hz. Without the average-and-decimate filter the signal >> at 8002Hz would come through at full strength. > > Ok, so is the attenuation of the 8002 Hz component that helps us reduce > the 2Hz aliased signal. Of course this means spectral information for > the environment shall be available in order to correctly define sampling > rate *and* filter definition. > >> If you figure out the phase delay in the filter vs. the amount of >> attenuation you for signals that will alias to within your loop >> passband, >> you'll find that the average-and-decimate filter tends to be more >> favorable than just about any other kind of anti-aliasing filters. > > Why not a low-pass filter? Is it a matter of 'complexity'?
Sort of. Unless your sampling rate is exceedingly generous you need far more than a 1st-order low-pass, and the filter absolutely positively must be minimum phase. You can implement all of this with a 5th- or 6th- or whatever-order IIR filter, but you end up with something that takes more time to implement, analyze, and verify than an average-and-dump. The average-and-dump filter also has very favorable action on random ADC noise (which your encoder experiences, if it's what I think it is).
> What I can do is to show what's the effect of some type of noise on our > system and warn our customer about the lack of a specification for the > filtering stage. They ought to know the microvibration environment at > instrument and platform level so they can specify what we should > implement. > > For the time being I only see a potential flaw in their specification > (the lack of a filter).
It may just be a non-problem. It's hard not to borrow trouble when you don't have information. A warning about vibration or electrical noise close to your sampling rate may be a good idea, though.
> []
[]
> [] >>> Sometimes the problem isn't fixable. A spourious value can be there >>> because of a heavy ion commuting the state of a register and here you >>> go with your crazy value. Failure analysis usually leads to >>> countermeasures to be implemented because you cannot get rid of the >>> root cause. >>> >>> >> True. If root cause analysis is being done, and the root cause really >> is unfixable, then of course you need to do something else. > > A low-pass filter will definitely dump the spikes, I'm not sure about an > average.
A moving average, or average-and-dump, _is_ a low-pass filter. So it'll reduce the spike magnitude. Be aware, however, that a low-pass filter is effective at filtering out noise that has zero mean and a mostly-Gaussian distribution. Noise that spikes every once in a while doesn't meet that criterion -- in that case, some sort of a median detector, or other filter that identifies outliers and tosses them, is a good idea. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com