68 lines
2.0 KiB
Matlab
68 lines
2.0 KiB
Matlab
display("Generating Features")
|
|
|
|
#load and plot raw data
|
|
#{
|
|
data structure of cellarray classes:
|
|
classes[1 to 5]
|
|
samples[1 to trainsetPerClass]
|
|
raw[1 to 3]
|
|
Accel[start:pEnd]
|
|
Gyro[start:pEnd]
|
|
Magnet[start:pEnd]
|
|
|
|
access the cells using classes{u}.samples{v}.raw{w}
|
|
#}
|
|
source("functions.m");
|
|
|
|
classes = {};
|
|
classes = getRawTrainData();
|
|
|
|
#outPath = "/home/toni/Documents/handygames/HandyGames/toni/img/raw"
|
|
#plotData(classes, outPath);
|
|
|
|
#calc and plot filtered data
|
|
filteredClasses = filterData(classes);
|
|
|
|
#outPath = "/home/toni/Documents/handygames/HandyGames/toni/img/filtered";
|
|
#plotData(filteredClasses, outPath);
|
|
|
|
#create sliding windows and add 6 additional signals pca and magnitude
|
|
#{
|
|
data structure of windowedClasses:
|
|
classes[1 to 5]
|
|
samples[1 to trainsetPerClass]
|
|
raw[1 to 15] <--- 15 different signals
|
|
3x WindowsAccel (X, Y, Z)
|
|
Win, Win, Win, Win ... <--- single matrices
|
|
3x WindowsGyro (X, Y, Z)
|
|
Win, Win, Win, Win ... <--- single matrices
|
|
3x WindowsMagnet (X, Y, Z)
|
|
Win, Win, Win, Win ... <--- single matrices
|
|
|
|
---> add 6 additional sensors: pca and magnitude
|
|
3x WindowsPCA (Accel, Gyro, Magnet)
|
|
Win, Win, Win, Win ... <--- single matrices
|
|
3x WindowsMagnitude (Accel, Gyro, Magnet)
|
|
Win, Win, Win, Win ... <--- single matrices
|
|
|
|
access the cells using classes{u}.samples{v}.raw{w}.wins{}
|
|
|
|
pca uses the eigenvector with the heighest eigenvalue as axis and projects the signals onto it for each sensor.
|
|
magnitude is calculated using sqrt(x^2 + y^2 + z^2) for each sensor.
|
|
#}
|
|
windowedClasses = windowData(filteredClasses);
|
|
|
|
#calculated features for the 5 signales (x, y, z, MG, PCA) of a sensor
|
|
#{
|
|
data structure of features
|
|
[classLabel, binMeans, rms, psd, windowMean, windowSTD, windowVariance, windowKurtosis, windowIQR]
|
|
#}
|
|
features = featureCalculation(windowedClasses);
|
|
|
|
#save features
|
|
save features.txt features;
|
|
display("saved features into features.txt");
|
|
|
|
|
|
|