## Monday 14 November 2022

### DSP Equations In Latex

I was recently documenting some DSP equations in Latex and couldn't find any suitable examples so I've put them together and thought I'd share.

## The Fourier Transform

\large \mathscr{F} \normalsize (x(t))=\int_{-\infty}^{\infty}x(t)e^{-j \omega t}dt

### Rendering

$$\large \mathscr{F} \normalsize (x(t))=\int_{-\infty}^{\infty}x(t)e^{-j \omega t}dt$$

## The Discrete Time Fourier Transform

X(k) = \sum_{n=0}^{N-1}x(n).e^{-j 2 \pi nk/N},\; for\; 0 \le k \le N-1

### Rendering

$$X(k) = \sum_{n=0}^{N-1}x(n).e^{-j 2 \pi nk/N},\; for\; 0 \le k \le N-1$$

## The Inverse Discrete Time Fourier Transform

x(n) = \frac{1}{N} \sum_{k=0}^{N-1}X(k).e^{j 2 \pi nk/N},\; for\; 0 \le n \le N-1

### Rendering

$$x(n) = \frac{1}{N} \sum_{k=0}^{N-1}X(k).e^{j 2 \pi nk/N},\; for\; 0 \le n \le N-1$$

## FIR Filter

y(n) = \sum_{n=0}^{N-1}h(k).x(n-k)

### Rendering

$$y(n) = \sum_{n=0}^{N-1}h(k).x(n-k)$$

## IIR Filter

y(n) = \sum_{k=0}^{N}a_{k}.y(n-k) + \sum_{r=0}^{M}b_{r}.x(n-r)

### Rendering

$$y(n) = \sum_{k=0}^{N}a_{k}.y(n-k) + \sum_{r=0}^{M}b_{r}.x(n-r)$$

## Roots Of Quadratic Equation $ax^{2} + bx + c = 0$

x=\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

### Rendering

$$x=\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$

## Notes

To align equations with the equals sign, embed in the following blocks, use "&=" for the alignment and separate each line by ending with " \\".

\begin{equation*}
\begin{align*}

\end{align*}
\end{equation*}

VSCode doesn't support equation numbering auto increment and Colab doesn't support "equation*" or "aligned*" for disabling equation numbers. Colab requires "aligned" not "align".

## Tuesday 21 June 2022

### DSP Tech Brief : Notes On Notch Filtering - IIR vs. FIR

A very simple way to implement a notch filter is to use and FIR filter and place a conjugate pair of zeros on the unit circle to define the location of the notch, as shown in the following z-Domain diagram:

Testing this filter in the application showed that while the initial results were good, because the interference was removed, there was a subtle negative impact on the performance of the signal processing functions further down the chain.

On investigation, the cause of this performance degradation turned out to be due to the FIR filter implementation not resulting in equal signal magnitudes in the pass-bands either side of the notch.

This can be clearly seen in the following diagram, where we have a sample rate of 16 kHz and a notch at 2 kHz.

Swapping the FIR filter for a single IIR biquad filter solved the problem and the IIR filter frequency response is shown below:

Functions for designing both FIR and IIR notch filters are included in the Numerix-DSP SigLib DSP and ML library, which can be downloaded from here: https://github.com/Numerix-DSP/siglib.

## Sunday 23 January 2022

### Analog I/O Example For The NXP LPC55S69-EVK

I recently wrote some DSP code for the excellent NXP LPC55S69-EVK.

The standard audio I/O example for the LPC55S69-EVK implements a very simple piece of code to read in an array of audio data from the stereo codec and then write it back. It does not show how to access that data or process it using background DSP functions.

I have written an example that uses interrupts, ping-pong buffers and background tasks to apply DSP functions to the real-time audio datastream.