Ang pahina na ito ay pinaglalagayang pinaglisan mula sa English at maaaring may mga maling pananaw. Ang English na pinanggalingan ay may awtoridad. Basa ang English original: Pagdisenyo ng filter

ROOTCASTLE / ENGINEERING LAB

Pagdisenyo ng filter

Biquad filters, Bode plots at C code.

LOCAL CALCULATION · RUNS IN THE BROWSER

✓ Stable: all poles inside the unit circle

-100-75-50-250101001k10k−3 dBf0Frequency [Hz]|H| [dB]
Floating pointQuantized Q14
-150-100-50101001k10kFrequency [Hz]Phase response [°]
0.250.50.751050100150Sampley[n]
ReIm
× poles○ zeros
|H(2kHz)|
-12.37 dB
∠H(2kHz)
-136.9°
Section
1
max |pole|
0.911594
Sectionb0b1b2a1a2
10.00391612350.0078322470.0039161235-1.81533960.83100411
1 · Q146412864-2974313615
/* Low-pass Q 0.7071, f0 1kHz, fs = 48000 Hz. Generated by Rootcastle LAB; verify against your own requirements. */
typedef struct { float b0, b1, b2, a1, a2; float z1, z2; } biquad_t;
static biquad_t stages[1] = {
  { 0.003916123487f, 0.007832246974f, 0.003916123487f, -1.815339612f, 0.8310041056f },
};
float filter_step(float x) {
  for (int i = 0; i < 1; i++) {
    biquad_t *s = &stages[i];
    float y = s->b0 * x + s->z1;
    s->z1 = s->b1 * x - s->a1 * y + s->z2;
    s->z2 = s->b2 * x - s->a2 * y;
    x = y;
  }
  return x;
}
Model and assumptions

Second-order IIR (biquad) sections are designed with the bilinear transform using R. Bristow-Johnson’s “Audio EQ Cookbook” formulas. As the corner approaches fs/2, frequency warping increases the deviation from the analog prototype. 4th- and 6th-order low/high-pass filters are cascaded with Butterworth Q values (the Q input is then unused). Fixed-point results show coefficient quantization only; accumulator overflow, rounding noise and limit cycles must be tested separately.

ω0 = 2π·f0/fs; α = sin ω0 / 2Q; H(z) = (b0 + b1·z⁻¹ + b2·z⁻²) / (1 + a1·z⁻¹ + a2·z⁻²)

Para saan ito gamit

Ang biquad ang pinakakaraniwang building block para sa pagkakawala ng hum ng main sa isang senyal ng sensor (50/60 Hz notch), paghahati ng isang vibration band, o pagsuporta ng noise sa isang control loop. Subukang gamitin ang design dito, makita ang magnitude at phase together, pagkatapos mag-verify ng coefficients at C code sa iyong sariling hardware.

Mga limitasyon

Nababawasan ng phase lag ang stability margin ng control loop; tukuyin muli ang phase margin bago ilagay ang filter sa loob ng loop. Sa fixed point, ang coefficient quantization ay nagdadala ng poles patungo sa unit circle sa mababang f0/fs ratios; kailangang subaybayan nang hiwalay ang accumulator width at overflow behaviour. Hindi ito nagpapalit sa analog anti-alias filter: kailangang maiwasan ang aliasing bago ang ADC.

References

R. Bristow-Johnson, “Cookbook formulae for audio EQ biquad filter coefficients” (W3C Audio EQ Cookbook) · A. V. Oppenheim, R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., ch. 6–7 · S. Butterworth, “On the Theory of Filter Amplifiers”, 1930

Educational model. Ang results ay hindi sapat para magdiagnose ng machine o mag-establish ng safe operating limits.

← Rootcastle LAB

Search commands o pages