display("rawPlot")

#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");

trainsetPerClass = 6; #number of used trainsets for one class
classes = {};
classes = getRawTrainData(trainsetPerClass);

#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 9] <--- 9 different signals
      WindowsAccel[2.5s at 200ms] 
        Win, Win, Win, Win ... <--- single matrices
      WindowsGyro[2.5s at 200ms]
        Win, Win, Win, Win ... <--- single matrices
      WindowsMagnet[2.5s at 200ms]
        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
windowedFeatures = featureCalculation(windowedClasses);

#train svm

#run svm
