added my octave stuff

added my octave stuff
This commit is contained in:
2016-01-02 13:46:34 +01:00
parent 74b55c0619
commit b58fb8f27b
5 changed files with 401 additions and 0 deletions

26
franke/octave/functions.m Normal file
View File

@@ -0,0 +1,26 @@
display("functions")
function win = window(vec, pos)
pos = pos / 10;
win = vec(pos-50:pos+50-1,:);
end
function flat = flatten(win)
flat = reshape(win, rows(win)*columns(win), 1);
end
# extract several (windowed) samples from the given input vector
function wins = getSamples(Gyro, Accel, Magnet, start, percent)
wins = {};
lengthMS = length(Magnet) * 10;
pEnd = lengthMS * percent;
for i = start:150:pEnd
winGyro = window(Gyro, i);
winAccel = window(Accel, i);
winMagnet = window(Magnet, i);
win = [winGyro winAccel];
win = flatten(win);
wins = [wins win];
end
end