Matlab provides a user-friendly programming environment with great flexibility, very well-suited to modeling, analyzing physiological data and developing biomedical signal processing algorithms. In this lab we will become familiar with handling and plotting discrete-time signals in the Matlab environment – both theoretical signals we generate with equations, and real data.
Part I: mathematical function plotting
Say you want to generate a sinusoid of a certain frequency, and plot it. Matlab, not being a live thinking
entity, has no clue what you want to do so you need to specify EVERYTHING to it.
Let’s say you want to plot a 5-Hz sinusoid over a 2-second time frame beginning at 0. We want it to have an
amplitude of 2 and have a cosine phase (begins at its peak/maximum at time 0). We are trying to construct
a signal that is a function of time, so we should therefore define ‘time.’ And it’s a discrete-time signal so we
need a value of the signal only at discrete – usually evenly-spaced – times. Let’s choose a ‘sampling rate’ of
200 Hz, in other words, choose to evaluate the function in discrete 5-ms steps:
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |