11-27-2007 02:20 PM
11-27-2007 02:23 PM
11-27-2007 02:58 PM
11-27-2007 03:03 PM
11-27-2007 04:01 PM
As I look at your data, what I see (I *think*) is an overall trend which has some high-frequency dithering due to quantization effects. Apparently, you have a threshold somewhere between adjacent quanta and would like to see when your data passes through it. However, the dithering causes some problems for the Threshold Peak Detector.
Given your .sig, I kinda suspect we're looking at encoder speed information that is calculated with a simple finite difference of position data divided by the sample period. If so, you may avoid some of these data processing issues if you acquire frequency directly instead of calculating it from an acquired position.
Meanwhile, an interesting filter you might try is a Median filter. It's really good at maintaining sharp transitions and not inducing a time delay between input and output. Other types of filtering or curve-fitting could also help, and there are many, many to choose among.
Can you describe the app a bit more? The best overall solution may require reframing the problem a bit...
-Kevin P.
11-27-2007 05:13 PM
11-28-2007 08:47 AM
Ok, gotcha -- the quantization has to do with A/D resolution. I'm accustomed to 16-bit +/- 10V max data acq cards which quantize to a much finer resolution than the 10's of mV seen in your screenshot. Still, you mention square waves, and I can't help but wonder if at least *some* of your measurements could be better handled with counters or hardware-timed digital input, once you TTL-ize the raw signal(s).
Anyway, you're going to need to clean up that signal somehow. The bottom line is that the dithering isn't real, it's just an artifact of the limited resolution of your acquisition. Thus you have no moral obligation to retain that high-freq dithering information. The "right" kind of filtering is highly dependent on the specific needs of a given app, so there isn't a perfect choice. All have trade-offs of one kind or another.
The Median filter is a software filter. My remark about time delay means this: if you pass your array into a Median filter and then plot the input and output together, the output will tend to show sharp transitions at the same index/time as the input. It tends not to induce a "phase delay" effect. Most other standard filter types *will* both induce a phase delay *and* round off the sharp edges of transitions. However, the Median filter is probably relatively slow in terms of execution time.
Since you expect square-like waves as input, be aware that many standard filters can produce a ringing phenomenon in their time-domain step response. This may steer you toward the Bessel style filters where such ringing is easier to avoid. Like most (all?) of the FIR and IIR family of filters, Bessels will induce a phase delay. However, if you subject all your inputs to the same Bessel filtering parameters, the *same* delay will be induced to each. Thus the phase *difference* between a pair of signals is preserved.
-Kevin P.
11-28-2007 08:49 AM
11-29-2007 11:24 AM
11-29-2007 01:26 PM