Maybe someone can put this in laymans terms!
I have a spec for a sensor measurement that words like this.
Minimum of 16000 samples per second, through a Low Pass 4-pole butterworth filter having a corner frequency of 1650hz. Digital filtering can be substituted for the butterworth filter.
The 16k sps I have no problem with, I'm actually getting around 56k samples per second. But the digital filtering is giving me a headache. does 1650 hertz mean that i can average my data down to 1650 samples per second?
What is the digital equivalant of a 4-pole butterworth?
A little background: I am taking data from an accelerometer and plotting it in a graph. the actual measurement window is only about 18 ms so I am only dealing with less than 2000 raw samples per graph!
Any comments appreciated, thanks!
Minimum of 16000 samples per second, through a Low Pass 4-pole butterworth filter having a corner frequency of 1650hz. Digital filtering can be substituted for the butterworth filter.
The 16k sps I have no problem with, I'm actually getting around 56k samples per second. But the digital filtering is giving me a headache. does 1650 hertz mean that i can average my data down to 1650 samples per second?
What is the digital equivalant of a 4-pole butterworth?
A little background: I am taking data from an accelerometer and plotting it in a graph. the actual measurement window is only about 18 ms so I am only dealing with less than 2000 raw samples per graph!
Any comments appreciated, thanks!
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
I'd have to port it over to the propeller,Is that code in C or asm!
Here is the filter spec:
FILTER SPECIFICATION FILE
FILTER TYPE:LOW PASS 1H
PASSBAND RIPPLE IN -dB -.2000E+01
STOPBAND RIPPLE IN -dB -.3000E+01
PASSBAND CUTOFF FREQUENCY 0.400000E+04 HERTZ
STOPBAND CUTOFF FREQUENCY 0.410000E+04 HERTZ
SAMPLING FREQUENCY 0.100000E+05 HERTZ
The software is fairly expensive.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
thanks
Post Edited (bambino) : 6/10/2009 3:08:54 PM GMT
IIR_Butterworth.filter( x, y, in_count, &IIR_Butterworth);
for (i = 0; i < in_count; i++)
fprintf (fout,"%f\n",y);
I assume the rest is bundled up in the call to the IIR_Butterworth.filter() routine
>·does 1650 hertz mean that i can average my data down to 1650 samples per second?
Bambino,
corner frequency has to do with the filter's roll-off point - if I recall correctly, it's where the tangent of·the flat-response side and·of the slope of the roll-off curve meet - they "corner" at that point of intersection.
> Low Pass 4-pole butterworth filter,· corner frequency of 1650hz.
I can't vouch for the accuracy as I've not had time to test this. It was generated here:
http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html
(Yeah, the math behind digital filtering and Fourier Transforms in general require many bottles of Excedrin Extra Strength [noparse]:)[/noparse]
HTH
- Howard in Florida
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Got Electrons?
OK, My C is pretty rusty, but stay tuned and I'll try to post some spin code ported from the filterloop routine.
It may be friday before I'll have time to finish it though.
Thanks for the link. It want help me make a full blown IIR object since I don't know how it arrived at the gain value, but it will let me carry on with my app. Thanks again.
One thing though! Does yv[noparse][[/noparse]4] have valid date output before the 4th loop through the filter or should those samples be dropped?
Post Edited (bambino) : 6/11/2009 12:37:39 PM GMT
···················· + ( -0.1774344076 * yv[noparse][[/noparse]0]) + (· 1.0075092500 * yv[noparse][[/noparse]1])
···················· + ( -2.2349793544 * yv[noparse][[/noparse]2]) + (· 2.3192063218 * yv[noparse][[/noparse]3]);
These fixed numbers here? are they decided from the gain?
What I really need to know is will these numbers be different if I ran different numbers through the calculator you posted the link to? I probably won't, but it would help me understand the routine more!
RE yv and valid results - it's very common that you have to let the filter run a few cycles to preload the values, make the transforms, and get good output. Roughly, this initial lag is usually negligible. As you can see from the code, values are recycled. Generally, this is called 'convolution' --- so yes, you do have to ignore some of the very initial results as they are undefined --- I just pick a number slightly larger than the whole convolution cycle, and ignore those results. Just glancing at that code, it might be four or five samples... but you might want to test that.
RE fixed values: try running different parms through that filter generator, and you'll see how it works - it's pretty straight forward. Yes, those fixed values *are* a direct result of the filter generating parameters.
- H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Got Electrons?
www.leonheller.com/Designs/Butterworth.gif
Scilab (free) can be used for designing both FIR and IIR filters, and will simulate them.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
@CRP That's great, just adjust the fixed values like I would a PID routine, I presume. Sort of trial and error.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Right, like most things [noparse]:)[/noparse]
Follow Leon's lead - he understands these things better than I --- and you both have the tools at hand.
cheers
- Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Got Electrons?
I think I've got enough to get started, maybe my honey do list is short this evening!
After thinking about it a while, I've decided to put the filter on the PC end of the App. Not Permenantly, but at least until the initial tests get done. I've got room for the floating point routines and extra cogs available, but the program in the propeller is the most bug free at the moment, so I'll leave it along and write the filter in VB.
Thanks again to you two for all your help!