Hot answers tagged

8

The two solutions in a floating point implementation are assumed to be identical, with the two BiQuads being a factored version of the standard difference equation. The BiQuad is the better way to go for fixed point as you isolate two 2nd order systems and in doing so will be easier to keep stable under variations due to the quantization involved. For more ...


7

You want to have an interpolation with a equal number of weights on both sides of the points you want to interpolate in between. So you choose either one or two weights on each side, resulting in an interpolation of two (linear) or four (cubic) points. An quadratic interpolation would need three points, which would only make sense at the border of a grid, ...


5

You are confusing "processing time" with "latency". Real-time filters are able to generate output samples at the same rate as they receive inputs. They would however induce latency, meaning that the bulk of the energy generated for an input appears later in time with respect to that input. Consider for example the following input/output: time : 0 1 2 3 4 ...


5

Tricky problem. Not sure I can answer this but here are a few pointers: Direct Form II is the worst biquad for audio processing. The transfer function between the input and the state is given just by the poles. The gain can be really large, I have seen gains of in excess of a 100 dB for reasonable audio filters. This makes real time switching of Direct Form ...


5

alright, there are a couple of different issues that may (or may not) need to be de-conflated. i'm gonna try to keep the number of symbols minimized. $dB_\text{gain}$ is the number of dB gain of the peak (for $dB_\text{gain} > 0$) or cut (for $dB_\text{gain} < 0$). it appears to be 6 dB in the plots. $$A^2 \triangleq 10^{dB_\text{gain}/20}$$ is ...


4

Another possibility is to send the coefficients as poles and zeros and interpolate/smooth in the z-plane instead of the coefficient domain. This is always guaranteed to be stable. You can either interpolate in real/imaginary presentation or, if you want to get fancy, in magnitude and phase. The first one is a lot easier, since the phase interpolation has to ...


4

Possible, yes. But higher-order IIR filters tend to be less stable and more susceptible to various numerical problems (lost precision, underflow, overflow, etc.), compared to a cascade or bank of suitable partitioned biquad filters.


3

Of course an SOS matrix is capable of completely describing the filter including the gain. However, in the Matlab SOS matrix the $b_0$ coefficients are all equal to $1$ by default (if no extra scaling is used), which is a kind of "neutral" scaling (and gets rid of one multiplication per second-order section). The gain factor $G$ is the overall gain necessary ...


3

I have too few points for to comment so I try give you at least a partial answer. You can't change those b coefficients using equal multiplier with a's. As those final coefficients comes from transformation there might be some ratios you loose in that process. In my MZT based example below, you get the final coefficients from equations b1 = -(pole1 + ...


3

So, sox defines its biquad operation parameters as follows: biquad b0 b1 b2 a0 a1 a2 Apply a biquad IIR filter with the given coefficients. Where b* and a* are the numerator and denominator coefficients respectively. See http://en.wikipedia.org/wiki/Digital_biquad_filter (where a0 = 1). This effect supports the −−plot global option. A biquad ...


3

According to the Audio EQ Cookbook the transfer function of a second-order band-pass filter with 0dB peak gain is given by $$H(z)=\frac{\alpha-\alpha z^{-2}}{(1+\alpha)-2\cos(\omega_0)z^{-1}+(1-\alpha)z^{-2}}\\=\frac{\alpha}{1+\alpha}\cdot\frac{1-z^{-2}}{1-\frac{2}{1+\alpha}\cos(\omega_0)z^{-1}+\frac{1-\alpha}{1+\alpha}z^{-2}}\tag{1}$$ where $\omega_0$ is ...


3

there is an earlier answer regarding how to more cheaply evaluate functions like sin() and log() and such. they're approximations, but very good ones.


3

More expensive computationally with marginal results. Most images don't require such interpolation technique. You can also look at this question: Higher order spline interpolation


3

I think the basic premise of your question is incorrect. Interpolating coefficients doesn't lead to unstable filters in biquads; moreover, it is very easy to prove. Just plot a1 vs a2 and you'll see that the stability region for the triplet of coefficients in the denominator is a convex spaces. Because of that, interpolating coeffs (as long as the same ...


3

Let's try this in Octave/Matlab: a = [1,-1.601089848140876,0.668366341586459]; b = [0.016819123361395717,0.033638246722791434,0.016819123361395717]; r = roots(a); abs(r) ans = 0.81754 0.81754 Since the roots are all inside the unit circle, your filter is stable. The magnitude response looks like it should for a Butterworth filter. However, as you'...


2

First, you need to start with in the s domain where a 2nd order transfer function (2 pole low pass filter) which can be written as follows. H(s) = s^2 + 2zws + w^2 Lets start with omega = 1 and zeta = sqrt(2)/2, then H(s) = s^2 + 1.414 s + 1 This filter's response and pole locations are shown here. To peak the response, simply modify zeta. Here zeta = ...


2

To get the frequency response, replace $z$ in $H(z)$ by $e^{j2\pi f/f_s}=\cos(2\pi f/f_s)+j\sin(2\pi f/f_s)$ where $f_s$ is the sampling frequency in Hz and $f$ is the desired frequency in Hz. This will give you the value of the frequency response at frequency $f$. Note that the frequency response is a complex function, so you might want to look at its ...


2

These scale values are applied before and after each section, so for $N$ sections you have $N+1$ scale values. Check the Matlab documentation, there must be some related property that you can set to 'scalar', and this will give you a single total scaling value. In any case, the total scaling is just the product of the three values in your case. So you have ...


2

It looks like you got your a and b coefficients swapped. The feedback terms: b0,b1,b2, should be tiny (around 0.00x), and a0,a1,a2 can be close to 1 or 2 in magnitude.


2

I was unable to get a stable filter using your coefficients. You did not state, but am assuming this is a lowpass filter. Using the calculator here, I got: coeffs = dict( a0=0.0010232172047183973, a1=0.0020464344094367946, a2=0.0010232172047183973, b1=-1.9075008174364765, b2=0.91159368625535, ) Filter Code: I recast to a Transposed ...


2

What I can see from the code is the following mapping between the array coeffs[] and the filter coefficients $a_i$ and $b_i$ (note that $a_0=1$ and is not stored in coeffs[]): $b_0=$coeffs[2], $b_1=$coeffs[1], $b_2=$coeffs[0] $a_1=$coeffs[4], $a_2=$coeffs[3] For the time being choose the scaling equal to $1$ (scalefactor=0) to check if everything else ...


2

Let me refer to the denominator coefficients as the pole coefficients, and the numerator coefficients as the zero coefficients. This is for those who visualize poles as able to peak magnitude, and zeros able to dip magnitude magnitude. For instance, if the biquad were all-pole (numerator = 1), the max magnitude could be found at the pole’s phase angle. ...


2

in this previous answer, the squared-magnitude of a biquad frequency response is shown to be: $$\begin{align} f(\phi) \triangleq |H(e^{j\omega})|^2 & = \left| \frac{b_0 + b_1 e^{-j\omega} + b_2 e^{-j2\omega}}{a_0 + a_1 e^{-j\omega} + a_2 e^{-j2\omega}} \right|^2 \\ & = \frac{B_0 + B_1 \phi + B_2 \phi^2}{A_0 + A_1 \phi + A_2 \phi^2} \\ \end{align}$$...


2

The reason why interpolating the coefficients would cause instability is that intermedite set of coefficients values could potentially produce poles outside the unit circle, thus making your filter unstable. Moreover, the values of the coefficients is not linearly related to the parameters of your filter, which means that it's not even going to avoid the ...


2

Consider a discrete-time LTI system (that's your second order stage) described by a LCCDE in the form of a recursion equation: $$y[n] = a y[n-1] + b y[n-2] + c x[n] + d x[n-1] $$ where $a,b,c,d$ are real or complex constants (coefficients of your IIR filter) and the values $y[n-1],y[n-2]$ are previous values of the output, where as $y[n]$ is the current ...


2

There is (at least) one error in your routine. It concerns the definition of alpha. The correct formula is $$\alpha=\frac{\sin(\omega_0)}{2Q}$$ However, you implemented $$\alpha=\frac{\sin(\omega_0)\cdot Q}{2}$$ But that shouldn't influence the function of the filter as a high pass filter; it just implements the inverse of the given $Q$ value. Other ...


2

Note that a biquad has $5$ degrees of freedom (not $6$), because $a_0$ can always be chosen as $a_0=1$ without loss of generality: $$\begin{align}H(z)&=\frac{b_0+b_1z^{-1}+b_2z^{-2}}{1+a_1z^{-1}+a_2z^{-2}}\\&=b_0\cdot\frac{1+\hat{b}_1z^{-1}+\hat{b}_2z^{-2}}{1+a_1z^{-1}+a_2z^{-2}},\qquad \hat{b}_1=\frac{b_1}{b_0},\;\;\hat{b}_2=\frac{b_2}{b_0}\tag{1}\...


2

You need to do partial fraction expansion. Most of the time, the result will be 3 parallel sections with the same poles as the original filter but only with a real zero in each parallel section. The first section is just a single real scale factor. $$H(z) = r0_0 + \frac{r0_1 + r1_1 \cdot z^{-1}}{a0_1 + a1_1 \cdot z^{-1} + a2_1 \cdot z^{-2}} + \frac{r0_2 + ...


2

It is well-known that the poles of a normalized continuous-time $n^{th}$-order Butterworth lowpass filter lie on a semi-circle with radius $1$, centered at $s=0$: $$p_k= e^{j\pi(2k-1+n)/2n},\qquad k=1,\ldots,n\tag{1}$$ Note that for odd order $n$, there is a single pole at $s=-1$. Combining the complex conjugate pole pairs, we can construct a polynomial $$D(...


1

Sorry, that doesn't work. You have to scale all numerator (the "b") or all denominator coefficients (the "a") at the same time. That doesn't work for the denominator since you all practical implementations require $a_0=1$. Scaling $a_1$ and $a_2$ without scaling $a_1$ will move the poles and change the overall shape of the transfer function and not just the ...


Only top voted, non community-wiki answers of a minimum length are eligible