06.11.2013, 07:04 PM
zum Filter...zb von
http://www-users.cs.york.ac.uk/~fisher/mkfilter/
mal schnell probiert: lowpass, 3. ord., Butterworth, 180Hz
produziert zb gleich code-output
Ansi ``C'' Code
/* Digital filter designed by mkfilter/mkshape/gencode A.J. Fisher
Command line: /www/usr/fisher/helpers/mkfilter -Bu -Lp -o 3 -a 4.0816326531e-03 0.0000000000e+00 -l */
#define NZEROS 3
#define NPOLES 3
#define GAIN 4.865363524e+05
static float xv[NZEROS+1], yv[NPOLES+1];
static void filterloop()
{ for (;
{ xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3];
xv[3] = next input value / GAIN;
yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3];
yv[3] = (xv[0] + xv[3]) + 3 * (xv[1] + xv[2])
+ ( 0.9500005509 * yv[0]) + ( -2.8987270898 * yv[1])
+ ( 2.9487100961 * yv[2]);
next output value = yv[3];
}
http://www-users.cs.york.ac.uk/~fisher/mkfilter/
mal schnell probiert: lowpass, 3. ord., Butterworth, 180Hz
produziert zb gleich code-output
Ansi ``C'' Code
/* Digital filter designed by mkfilter/mkshape/gencode A.J. Fisher
Command line: /www/usr/fisher/helpers/mkfilter -Bu -Lp -o 3 -a 4.0816326531e-03 0.0000000000e+00 -l */
#define NZEROS 3
#define NPOLES 3
#define GAIN 4.865363524e+05
static float xv[NZEROS+1], yv[NPOLES+1];
static void filterloop()
{ for (;
{ xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3];
xv[3] = next input value / GAIN;
yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3];
yv[3] = (xv[0] + xv[3]) + 3 * (xv[1] + xv[2])
+ ( 0.9500005509 * yv[0]) + ( -2.8987270898 * yv[1])
+ ( 2.9487100961 * yv[2]);
next output value = yv[3];
}
Don't worry about getting older. You're still gonna do dump stuff...only slower