Create a test signal with 3 different levels corresponding to class0, class1, class2 as Sdat
and create signal x where each class corresponds to a different frequency
our data
our signal
Now plot the class signal Sdat[n] that indicates which of the 3 frequencies is present
and plot the signal x[n]
only the first 200 points are plotted below
the variable clasWid determines how many samples wide each Sdat signal is
Part 2
One type of frequency demodulator takes the derivative of the signal,
then akes the absolute value,
then lowpass filters (we will use an 8-point running sum for the lowpass filter).
This will be out feature signal g[n]
take backward difference first
take absolute value
lopass filter with running sum
time shift (why?)
Part 3
Since we have 3 simple classes, we will use 2 thresholds,
and classify to generate the output signal s[n]
that should ideally equal the original data Sdat[n]
Part 4 Create a simple nearest neightbor classifier
Create a training set of sample data for the classifier using the last 50 samples of Sdat at centers
of the data pulses
true class for the sample
feature voltage of the sample
Run the classifier and save data in sNear
Next, compute the error rate for the first half of the data set
Part 5 Observing the frequency spectrum
Next, compute the DFT using the formula below instead of
the Mathcad built-in FFT
Part 6 creating a new feature
to demonstrate a vector feature, we shall use a bandpass filter
and take the magnitude of the output to construct a new feature..
For simplicity we will use a ttirangle-weighted complex exponential
Contruct a delayed impulse to test our filter
Do the convolution
Take the DFT
compare the filter freq response to the spectrum of the signals
Next, filter the signal and take the magnitude to form our second feature
time shift (why?)
lopass filter with running sum
time shift (why?)
Part 6 plotting the feature vector training set
Create a training set of sample data for the classifier using the last 50 samples of Sdat at centers
of the data pulses
true class for the sample
feature voltage of the sample
create class data vectors for each class
You could implement a vector classifier using the above training set,
as discussed in class