Laboratory #4d
Data Analysis and Pattern Recognition



4. Classifying Radio Baton Data

4.1 Introduction

The experiments in this part of Lab 4 require some Matlab programming. The purpose is to use measured Radio Baton data to create a classifier to discriminate six baton positions.


4.2 Gathering the Radio Baton Data


The procedure for gathering the Radio Baton data is essentially the same as in Lab #3, Part 4.1.

1. Connect the Radio Baton to the Soundblaster card. Make sure the cable marked Midi In is connected to the Radio Baton plug marked Midi Out. Make sure the cable marked Midi Out is connected to the Radio Baton plug marked Midi In.

2. Plug the Radio Baton power cord into the wall.

3. Run Matlab

4. Launch CVI

5. Load the project Baton1.prj and run it.

6. The blue light should turn on indicating the baton is connected correctly.

7. Click on the start button. Notice as you move the batons that the data changes. Once again, the baton that corresponds to the upper data will be called the left baton.

8. We want to collect data with the left baton going around the following circuit 4 times:
  1. rear left corner
  2. front left corner
  3. front right corner
  4. rear right corner
  5. center, on the base
  6. center, a foot or so above the base
To help in doing this, type the following into Matlab:
clear data;
for k=1:24,
fprintf('\nNext ...');
pause;
data(k,:) = cvi_data;
end;
After you type "end;", the program will start to execute. Each time that it types "Next ...", position the baton at the next point on the circuit. When you are set, click on the Mat-Lab button, and release the "pause" by pressing any key on the keyboard. The program should stop after the 24th point.


4.2 Inspecting the Radio Baton Data


The data array has 24 rows and 3 columns. Each row corresponds to one of the recorded positions. Each column contains the xyz coordinates of the baton position.

1. To see the xy coordinates (as if you were looking down on the base), type
plot(data(:,1), data(:,2), 'o')
You should see 5 clusters.
2. To see the xz coordinates (as if you were looking in from the front), type
plot(data(:,1), data(:,3), 'o')
You should see 4 clusters.

4.3 Classifying the Radio Baton Data


1. Compute the means for the data in each of the 6 actual clusters, and store them in a 6-by-3 array called means. (This should be no problem for the CS students, or for anyone who is experienced with Matlab, and you folks should do this on your own. If this is beyond your ability, there is no penalty for using my solution.) 2. Write a Matlab program to go through the 24 positions and find the closest mean vector for each position. (Although it is not necessary, it helps a bit to know that the Matlab function norm(x) returns the Euclidean norm of a vector x, and that the Matlab function min(x) returns two values, the minimum value of the vector x and the index for the first occurrence of that minimum value. Musicians are allowed to use my solution.)


On to Lab #5Fuzzy Logic

Up to Lab #4 and 5