added my octave stuff
added my octave stuff
This commit is contained in:
26
franke/octave/functions.m
Normal file
26
franke/octave/functions.m
Normal 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
|
||||
Reference in New Issue
Block a user