DSP EA Laboratory
DSP EA Laboratory
DSP EA Laboratory
Applications
Laboratory Experiments
Contents:
General Information
Handle the hardware in the laboratory (the measurement equipment, PCs, cables,
connectors etc.) with care!
All user files have to be stored in C:\usr. There you will find a subdirectory
DSP_EngineeringApplications, where the files required for this lab are stored.
For your own files (documents, screenshots etc.) create another subdirectory in
C:\usr for your lab group. At the end of each lab session, copy your files on a
USB stick.
Please use a blank USB stick containing no other data. The stick is scanned by the
virus scanner and will generate an alarm, if a virus is detected!
MATLAB: If you are not familiar with MATLAB, prepare for the lab by studying an
online tutorial (available e. g. at www.mathworks.com). The comprehensive
documentation is available on the PCs (MATLAB online help).
Scilab and Octave are free software packages which are widely compatible with
MATLAB:
Scilab: http://www.scilab.org/
Octave: http://www.gnu.org/software/octave/
Laboratory report: Each student has to prepare one report. Some hints for the report:
o On the title page include your name, HSM-ID (Matrikel-Nr.) and the date
when you finished the report.
Do not change the language settings (English) of both the oscilloscope and the BenchVue
software.
The following instructions refer to the DSOX 2002A. The operation of the DSO 6032A is
similar; the BenchVue software is used for both oscilloscopes. In the text below, [key]
refers to a key and SK[key] refers to a softkey of the oscilloscope. A softkey is one of the
five keys below the screen. By rotating and pressing the entry knob to the right of the screen
you select entries in the softkey menus. With the round key (Back) to the left of the
softkeys you can step back in the softkey menu.
1. Connect the function generator output to channel 1 input of the oscilloscope. Generate a
1 kHz sine wave with amplitude 2 Vpp (peak-to-peak). Press [Autoscale] on the
oscilloscope.
The status line at the top of the display shows the vertical and the horizontal scale settings.
When you followed the previous steps, the vertical scale now is 500 mV/ and the
horizontal scale is 200 µs/.
3. Measure the amplitude (peak-to-peak) and the frequency of the sine signal:
− Key [Meas] SK[Source] Select channel 1
− SK[Type] Select "Peak-Peak" with the entry knob
− SK[Add Measurement] Select "Frequency" with the entry knob
The measurements of the sine signal should show an amplitude of 2 Vpp and a frequency
of 1 kHz. If the amplitude is too large, the load setting of the function generator has to be
corrected. The function generator has a source impedance of 50 . If the generator is
connected to a 50 load, the amplitude is only one half compared to the case when the
generator is connected to a high impedance load. The generator can be configured for a
50 load or a high impedance load in order to show the correct amplitude. The setting
can be modified in the menu. Press the keys [Shift] [Menu], navigate with the arrow
keys to D:SYS MENU and further to 1:OUT TERM, where you can select either 50 OHM
or HIGH Z. Since the oscilloscope is a high impedance load (approx. 1 M), choose
HIGH Z.
Ua
HP33120A
Upp
Ri = 50
t
RL Ua
Figure 1-1: The amplitude of the function generator depends on the load impedance RL
2. To start the oscilloscope app, double-click on the oscilloscope symbol in the lower right
corner.
3. Go to the Screen Image tab. Select "Invert Colors" (otherwise the graphics have a black
background color, which is unfavorable for printing). Click on "Get Current Screen".
4. Click on "Export" or the save symbol in order to save screenshots of the oscilloscope in
various formats.
Measurements in the frequency domain are based on the Discrete Fourier Transform (DFT).
Fast Fourier Transformation (FFT) is a term for algorithms, which allow for a fast and
efficient computation of the DFT. In this section we use the oscilloscopes built-in FFT
function to display the spectrum of the signal.
On the screen the magnitude spectrum of the signal is displayed. The frequency range
(span) and the resolution are displayed above the softkeys.
2. The span depends on the sampling rate. The sampling rate is shown in the upper right
corner and depends on the horizontal scale setting. A horizontal scale of 200 µs/ results in
a sampling rate of 250 MSa/s (Million Samples per second). However, the FFT sampling
rate is usually lower and is related to the span by
FFT sampling rate = 2 times Span
The resolution depends on the FFT sampling rate:
Resolution = FFT sampling rate / Number of samples
Change the horizontal scale and observe how this changes the signal in the time domain,
the sampling rate, the span and resolution of the FFT.
By manually setting the span and the center frequency you can zoom into the FFT (this
was done in the screenshot shown). But this does not change the resolution! With the
knobs to the right of the [Math] key you can change the vertical scale of the FFT.
3. Autoscale the FFT (SK[More FFT] SK[Auto Setup]). Set the horizontal scale to
200 ms/. The span now is 15.6 kHz (sampling rate 31.2 kHz). The spectral line of the sine
wave at 1 kHz is clearly visible [DSO 6032A: horizontal scale 2 ms/, span 25 kHz,
sampling rate 50 kHz]. Use the cursor to measure the frequency:
Key [Cursors] SK[Source] select Source: Math, SK[Cursor] select X1,
move the cursor in x direction by turning the cursor knob. Move the cursor to the peak,
the frequency is displayed in the cursor box.
4. The FFT vertical units are dBV (Decibel-Volt referenced to an rms voltage of 1 V):
U rms
U dBV 20 log
1V
A sine wave having an rms (root-mean square) voltage of 1 V has an amplitude of 0 dBV.
Use the cursor to measure the amplitude:
Key [Cursors] SK[Source] select Source: Math, SK[Cursor] select Y1,
move the cursor in y direction by turning the cursor knob. Move the cursor to the peak,
the amplitude is displayed in the cursor box.
5. Select different amplitudes at the function generator, and note down in a table the
following values:
The peak-to-peak amplitude of the function generator
The calculated rms value
The calculated dBV value
The measured dBV value
6. When the amplitude of the input signal exceeds the vertical range of the oscilloscope, the
signal is clipped. Increase the amplitude of the function generator until clipping occurs,
while observing the spectrum. In order to see more details in the spectrum, you can switch
off the time-domain signal by pressing key [1] for channel 1 two times.
1.4 Aliasing
1. Adjust the function generator to generate a sine wave with a frequency of 1 kHz and an
amplitude of 2 Vpp. Adjust the horizontal scale of the oscilloscope to 200 ms/, activate
the FFT and select auto setup (SK[More FFT] SK[Auto Setup]). The span will
be 15.6 kHz [DSO 6032A: 2 ms/, Span 25 kHz].
2. Increase slowly the frequency of the function generator. Wait for a stable FFT display and
watch the peak in the spectrum moving to the right.
3. Increase the frequency beyond 15.6 kHz. Since the FFT sampling rate is 31.2 kHz, signals
above 15.6 kHz will be aliased. Watch the peak, while increasing the frequency
further[DSO 6032A: sampling rate 50 kHz, aliasing above 25 kHz].
4. What happens, if you reach a frequency of 31.2 kHz [DSO 6032A: 50 kHz]? What
happens, if you increase the frequency further?
5. Complete the table below. f0 is the function generator frequency, and FFT frequency is the
frequency of the peak in the spectrum.
6. Select different frequencies at the function generator, and note down in a table the
following values:
Generator frequency f0
Effective sampling rate (FFT sampling rate) fs
FFT frequency (frequency of the peak in the spectrum)
The difference fs − f0
The sum −fs + f0
1. Start MATLAB. Try out some commands. Clear the Workspace (enter clear) and the
Command Window (enter clc).
Hint: Test your MATLAB commands with a few samples first and observe the output. The
output of a command in the Command Window can be suppressed by attaching a
semicolon at the end of the command.
3. Generate a plot including plot labels and axes labels similar to Figure 2.1. Use the
commands subplot(), plot() and stem(). Plot the first 33 samples of the sine
signal.
4. Generate a script file sinus.m containing the MATLAB code developed so far. You can
copy the commands from Command History Window.
5. Clear the Workspace and the Command Window (see above). Run and test the script file
sinus.m.
6. Use the command sound() to send the signal to the sound card (make sure to use the
correct sampling rate). Connect the headphones to the audio output and listen to the
signal. Next, connect the oscilloscope to the audio output.
− Measure frequency and amplitude of the signal in the time domain.
− Measure frequency and amplitude of the signal using the FFT function. Convert the
dBV value of the amplitude to the peak-to-peak value.
More hints: You obtain a more compact output in the Command Window, if you enter the
command format compact.
By default numbers are printed with 6 digits in the Command Window. You
can see more digits if you enter the command format long.
The command close all closes all graphics windows.
f = 1 k Hz , fA = 8 kHz
1
0.5
sin(2 f t)
0
-0.5
-1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t [s] -3
x 10
1
0.5
sin(2 f t)
-0.5
-1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t [s] -3
x 10
1. Add a second sine wave to the 1 kHz signal. The second signal shall have the amplitude
A = 0.5 and the frequency f = 1.7 kHz. Again, generate a plot of the first 33 samples.
2. The sound() command assumes that the signal is in the range 1. Larger amplitudes
will result in distortions. Scale your dual tone signal accordingly.
3. Send the signal to the sound card and connect the oscilloscope.
− Measure the frequencies and amplitudes of the two sine signals using the FFT
function.
− Convert the dBV values of the amplitudes to their peak-to-peak values, and confirm
that the ratio is 2:1.
− Calculate the ratio of the amplitudes using the dBV values.
| DFT |
where T = 1/fs is the sampling period. It is calculated as the square of the magnitude of the
discrete Fourier transform (DFT) of x(n):
N 1
S DFT ( k ) x ( n ) e j 2 π n k / N , k 0 , 1, ..., N 1
n 0
fs /N
Figure 3-1: Each FFT value represents the power in the frequency range f
In this experiment we will calculate the periodogram of the dual tone signal of Section 2.2.
The power spectral density of a sine signal with frequency f0 and amplitude A is given by
4
2
and its signal power is S = A /2.
1. Use the MATLAB code from Section 2.2 to generate the dual tone signal (frequencies
1 kHz and 1.7 kHz, amplitudes 1 and 0,5, sampling rate 8 kHz). Now the signal shall have
a length of N = 4096 samples. Modify the code accordingly.
2. Calculate the periodogram of the signal. Use the MATLAB function fft() to calculate
the DFT. Plot the whole spectrum over k (k = 0, 1, …, N 1).
4. Determine the maxima of the peaks and their position in the spectrum. Use the values to
calculate the signal power of the two sine signals.
5. Plot the spectrum in Decibels (dB) over frequency in the range 0 f fs /2.
1 - Three Baseline Conditions: 270 lbs of load, sample rate of 97,656 sps, for 6 seconds
2 - Three Outer Race Fault Conditions: 270 lbs of load, sample rate of 97,656 sps for
6 seconds
3 - Seven More Outer Race Fault Conditions: 25, 50, 100, 150, 200, 250 and 300 lbs of load,
sample rate of 48,828 sps for 3 seconds
4 - Seven Inner Race Fault Conditions: 0, 50, 100, 150, 200, 250 and 300 lbs of load, sample
rate of 48,828 sps for 3 seconds
5 - Analysis: Data analysis (.m) files provided with the data which we will not use here.
6 - Real World Examples: Data from an intermediate shaft bearing from a wind turbine,
an oil pump shaft bearing from a wind turbine, and a real world planet bearing fault.
2. The data files are MATLAB binary files (.mat). Copy the file baseline_1.mat to your
working directory. Load the file with load('baseline_1'). In the workspace, you
can see that the file contains a structure "bearing". Double-click on it to open the Array
Editor. There you can see that the structure has four fields:
sr: the sampling rate
gs: the signal
load: the load applied to the bearing
rate: the shaft rate (frev)
4. Use the code from Section 3 to calculate the periodogram of the signal. Plot the spectrum
in Decibels (dB) over frequency in the range 0 f fs /2.
5. The characteristic frequencies of the bearing are at rather low values. Plot the spectrum in
dB over frequency in the range 0 f 500 Hz. For the baseline signals, you will see
spectral lines at frev = 25 Hz and integer multiples.
6. Now repeat steps 2 to 5 for an outer race fault file. Describe the differences you can see in
the time domain and in the frequency domain with respect to the baseline signal. For an
outer race fault, we expect to see a spectral line at BPFO. Try to identify this line (this is
not for all outer race fault files possible).
7. Now repeat steps 2 to 5 for an inner race fault file. Describe the differences you can see in
the time domain and in the frequency domain with respect to the baseline signal. For an
inner race fault, we expect to see a spectral line at BPFI. Try to identify this line (this is
not for all inner race fault files possible).
8. Use the command sound() to send the signal to the sound card and listen to the audio
(make sure to use the correct sampling rate, and scale the amplitude to the range 1).
When a ball hits a fault on the outer or inner race, a signal with BPFO or BPFI is generated,
respectively. However this signal modulates signals at other characteristic frequencies. One
method for demodulating these amplitude modulated signals is envelope detection. A simple
version is composed of the following signal processing steps:
take the absolute value of the signal
apply a lowpass filter
remove the mean from the signal
1. Design a FIR lowpass filter using the MATLAB function fir1(). Use a filter order of
256 and a cutoff frequency of 1000 Hz (note that MATLAB uses a normalized frequency
range 0 … 1, where 1 corresponds to fs /2). Plot the impulse response (i. e. the filter
coefficients) of the filter.
2. Plot the transfer function of the filter using the function freqz().
3. Take the absolute value of the bearing signal (function abs()) and filter this signal using
the lowpass filter (function filter()).
4. Remove the mean from the signal (use the function mean() to calculate the mean).
5. Calculate the periodogram of this signal using the code from Section 4.1. Plot the
spectrum in dB over frequency in the range 0 f 500 Hz.