_images/title_Introduction.png

Why do signal processing?

“Data is the new oil”, said the mathematician Clive Humby, who with his wife made $140 mio helping UK retailer Tesco with its Clubcard system. Just as crude oil is not very useful when it comes out of the ground, it can be refined into amazing things (fertilizer, gasoline, plastic,... ) when processed correctly. The same is true for biomedical signals: in their unprocessed form, they don’t really help much. But when we extract the correct parameters, we can detect diseases, measure brain waves, look into the human body, predict future health problems, etc.

A nice discussion of this topic can be found in:

Rangayyan, R. M. (2002) Biomedical Signal Analysis (pp. 49-52). Piscataway, NJ: IEEE Press.

which also gives a good introduction into the field.

Another very recommendable book, which approaches signal processing from the engineering point of view, is:

R.G. Lyons (2011) Understanding Digital Signal Processing. Pearson

Important Topics

_images/SignalProcessing.jpg

Figure 8: This figure shows some of the main topics and questions in digital signal processing (inspired by the excellent book by R.G.Lyons “Understanding Digital Signal Processing”)

What is the basic Procedure?

  • Define the problem
  • Identify the data of interest
  • Collect the data
  • Import the data
  • Evaluate the data quality
  • Preprocess the data
  • Analyse the data
  • Report the results

Conventions and Basics

Movements in 3-dimensional space consist of translations as well as rotations. We will use the following conventions:

Notation

  • scalars are indicated by plain letters (e.g. a)

  • vectors are written with an arrow above (e.g. \(\vec{r}\) ) or in round brackets

    \[\begin{split}e.g.\left( {\begin{array}{*{20}{c}} {{r_1}}\\ {{r_2}}\\ {{r_3}} \end{array}} \right)\end{split}\]
  • matrices are written bold (e.g. R) or in square brackets

    \[\begin{split}\left[ {\begin{array}{*{20}{c}} {{R_{11}}}&{{R_{12}}}&{{R_{13}}}\\ {{R_{21}}}&{{R_{22}}}&{{R_{23}}}\\ {{R_{31}}}&{{R_{32}}}&{{R_{33}}} \end{array}} \right]\end{split}\]
  • vector- and matrix-elements are written in plain style, with indices denoted by subscripts (e.g. \(r_1; R_{12}\))

  • multiplications with a scalar are denoted by \(\ast\) (e.g. \(tan(\theta/2) \ast \vec{n}\) )

  • scalar-vector-products and matrix-multiplications are denoted by \(\cdot\) (e.g. \(\vec{p} \cdot \vec{q}\) )

  • vector-cross-products are denoted by \(\times\) (e.g. \(\vec{p} \times \vec{q}\) )

Mathematical Basis

Scalar Product

The scalar product of two vectors \(\vec{a}\) and \(\vec{b}\) is defined as

\[\begin{split}\left( {\begin{array}{{20}{c}} {{a_1}}\\ {{a_2}}\\ {{a_3}} \end{array}} \right) \cdot \left( {\begin{array}{{20}{c}} {{b_1}}\\ {{b_2}}\\ {{b_3}} \end{array}} \right) = {a_1}{b_1} + {a_2}{b_2} + {a_3}{b_3} = |\vec a|\, \cdot |\vec b| \cdot \cos (\theta )\end{split}\]
image2

Graphical interpretation of scalar- (left) and vector-product (right)

Cross Product

The cross product of two vectors \(\vec{a}\) and \(\vec{b}\) is defined as

\[\begin{split}\left( {\begin{array}{{20}{c}} {{a_1}}\\ {{a_2}}\\ {{a_3}} \end{array}} \right) \times \left( {\begin{array}{{20}{c}} {{b_1}}\\ {{b_2}}\\ {{b_3}} \end{array}} \right) = \left( {\begin{array}{{20}{c}} {{a_2}{b_3} - {a_3}{b_2}}\\ {{a_3}{b_1} - {a_1}{b_3}}\\ {{a_1}{b_2} - {a_2}{b_1}} \end{array}} \right)\end{split}\]

The resulting vector is perpendicular to \(\vec{a}\) and \(\vec{b}\) , and vanishes if \(\vec{a}\) and \(\vec{b}\) are parallel.

Matrix Multiplication

In general, the multiplication of two matrices A and B is defined as

\[A \cdot B = C\]

with \({C_{ik}}\, = \,\sum\limits_j {{A_{ij}}} {B_{jk}}\).

This equation can also be used for multiplication of a matrix with a vector, when the vector is viewed as a matrix with three rows and one column. Matrix multiplications are very important in Matlab, as they are directly implemented, and save not only a lot of coding, but also a lot of time. For example,

A = randn(500);
B = randn(500);
tic
for ii = 1:500
    for jj = 1:500
        C(ii,jj) = A(ii,:) * B(:,jj);
    end
end
withLoops = toc

tic
C=A*B;
withoutLoops = toc

gives on my computer a ratio of about 65!

Basic Trigonometry

The basic elements of trigonometry are illustrated in the Figure below

image3

Basic trigonometry

Discrete Signals

Discrete signals are signals that are sampled at fixed points in time. Typically, all signals we work with in signal analysis are discrete, digital signals. Digital signals are signals that are stored with finite precision. This can lead to artifacts in the data analysis.

The information we obtain from discrete signals is limited by the Nyquist theorem: The highes frequency about which we can say something is half the sampling frequency. Higher frequencies can show up as artifacts (see Figure below):

_images/Nyquist.png

Figure 9: Two different sine waves (here with 1Hz and 7Hz) pass through the same discrete values.

Exercises

  • Create two cycles of a noisy sine wave, with the following properties:
    • amplitude = 1
    • frequency = 0.3 Hz
    • sampling rate = 100 Hz
    • Gaussian random noise, with a standard deviation of 0.5.
  • Plot the wave, label the x- and the y-axis, and add a title to the plot.
  • When this works, take your command history, and create a Matlab function that
    • takes the number of cycles and the frequency as input
    • sets the remaining parameters as above
    • shows the resulting graph
  • Set a breakpoint in the function, and inspect the workspace variables at that point. Modify the amplitude to “2”, and continue the function.
  • Hard: create a graphical user interface (GUI, see last chapter) for this function, as shown in the Figure below.
image4

Simple graphical user interface (GUI)

matlab DataGen.m shows how to write data in different formats.