Guessing at the discretization, of the Sallen-Key Filter, with Q-Multiplier.

One concept that exists in modern digital signal processing is, that a simple algorithm can often be written, to perform what old-fashioned, analog filters were able to do.

But then, one place where I find lacking progress – at least, where I can find the information posted publicly – is, about how to discretize slightly more complicated analog filters. Specifically, if one wants to design 2nd-order low-pass or high-pass filters, one approach which is often recommended is, just to chain the primitive low-pass or high-pass filters. The problem with that is, the highly damped frequency-response curve that follows, which is evident, in the attenuated voltage gain, at the cutoff frequency itself.

In analog circuitry, a solution to this problem exists in the “Sallen-Key Filter“, which naturally has a gain at the corner frequency of (-6db), which would also result, if two primitive filters were simply chained. But beyond that, the analog filter can be given (positive) feedback gain, in order to increase its Q-factor.

I set out to write some pseudo-code, for how such a filter could also be converted into algorithms…


Second-Order...

LP:
for i from 1 to n
Y[i] := ( k * Y[i-1] ) + ((1 - k) * X[i]) + Feedback[i-1]
Z[i] := ( k * Z[i-1] ) + ((1 - k) * Y[i])
Feedback[i] := (Z[i] - Z[i-1]) * k * α
(output Z[i])

BP:
for i from 1 to n
Y[i] := ( k * Y[i-1] ) + ((1 - k) * X[i]) + Feedback[i-1]
Z[i] := ( k * (Z[i-1] + Y[i] - Y[i-1]) )
Feedback[i] := Z[i] * (1 - k) * α
(output Z[i])

HP:
for i from 1 to n
Y[i] := ( k * (Y[i-1] + X[i] - X[i-1]) ) + Feedback[i-1]
Z[i] := ( k * (Z[i-1] + Y[i] - Y[i-1]) )
Feedback[i] := Z[i] * (1 - k) * α
(output Z[i])

Where:

k is the constant that defines the corner frequency via ω, And
α is the constant that peaks the Q-factor.

ω = 2 * sin(π * F0 / h)
k = 1 / (1 + ω), F0 < (h / 4)

h   Is the sample-rate.
F0  Is the corner frequency.

To achieve a Q-factor (Q):
α = (2 + (sin^2(π * F0 / h) * 2) - (1 / Q))
'Damping Factor' = (ζ) = 1 / (2 * Q)

Critical Damping:
ζ = 1 / sqrt(2)
(...)
Q = 1 / sqrt(2)



(Algorithm Revised 2/08/2021, 23h40. )

(Computation of parameters Revised 2/09/2021, 2h15. )

(Updated 2/10/2021, 18h25… )

Understanding NMR

Under ‘the term NMR’, people may correctly understand two different subjects:

1. Why do subatomic particles, in this case nuclei, precess?
2. How do Engineers exploit this precession, in order to form 2D and 3D images, in ‘NMRI’?

In this posting, I am only going to address subject (1).

Precession and spin are easier to understand, when we can simply apply the Newtonian concepts. Quantum Mechanics today tends to obscure the subject of precession. And so for most of this post, I am going to make the somewhat daft assumption that the precession of subatomic particles, is Newtonian.

If a gyroscope is spinning along an arbitrary axis, and if we apply torque to its axis, this torque integrates into the spin vector – at an angle to the existing spin vector. Unless we are accelerating or slowing down its spin. This results in the spin vector rotating – and thus in precession.

But, if we have seen the demonstration in which an off-axis gyroscope is precessing on a passive pedestal, we also observe that eventually the phenomenon weakens, and that the practical axis seems to shift further and further in the direction gravity is pulling on it.

The reason this weakening takes place, is the fact that some additional torque is being applied to the gyroscope, against the direction in which it is precessing. Otherwise, it would just precess forever. This additional torque could be due to friction with the pedestal, due to air resistance, due to magnetism, or whatever.

An artillery shell is aerodynamically designed, so that as long as it has excess spin, interaction with the air will always push it in the direction of any existing precession, and so this type of object will tend to straighten its axis of spin, into the direction with which it is flying. This would be the equivalent to the gyro from before, straightening up and standing up against gravity again.

Atomic nuclei that have an odd mass number, also have a non-zero spin quantum number, thus having spin, and also have a magnetic dipole moment. The wanton assumption could be made that its magnetic dipole moment is always parallel to its axis of spin. But then if we visualize matter as consisting of nuclei that are separated by vast, less-dense clouds of electrons, it would seem to follow that each nucleus is always precessing in response to local magnetic fields.

And even if we were to apply an external magnetic field to such a system, it would follow that precession could not yet be detected externally, because the nuclei are all out-of-phase. Ostensibly, they would also continue to precess, and to stay out of phase, simply due to an applied magnetic field. The only big difference with the practical gyro should then be, that the magnitude of their spin-vector should never change, since this should be intrinsic.

But if we were to insist on this very Newtonian description, then something else should also happen that is not as obvious. Those thin wisps of electrons should not only react to the applied field, but also locally, to the field of each nucleus precessing. So if we assume conservation of energy, there would also be reactive torque acting on each nucleus, in response to its own precession, because the density of the electron clouds is not zero.

After a certain settling period which is measurable, the nuclei end up aligning themselves with the applied field, resulting in the state that has its lowest-possible potential energy. This takes milliseconds instead of the nanoseconds that some of these behaviors should take on the subatomic scale. Precession has still not been detected.

Likewise, the fact that subatomic decay can take years instead of nanoseconds, refutes certain mundane explanations, of what might be causing that.

Well, one thing that Scientists can do is compute what the dipole moment of such a nucleus is, as well as the magnitude of its angular momentum – spin – and to compute as a function of the applied field-intensity, with what frequency all the nuclei should be precessing… This frequency is called the “Larmor Frequency”.