-
Notifications
You must be signed in to change notification settings - Fork 1
/
accelerometerEllipseFitting.m
67 lines (52 loc) · 2.22 KB
/
accelerometerEllipseFitting.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%% Load the data
dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'full-sphere');
[accelerometer, ~, ~, ~] = loadData(dataSetFolder);
% Fetch axes
x = accelerometer.Data(:, 1);
y = accelerometer.Data(:, 2);
z = accelerometer.Data(:, 3);
%% next data set
dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'unmoved-with-x-pointing-forward');
[accelerometer, ~, ~, ~] = loadData(dataSetFolder);
% Fetch axes
x = [x; accelerometer.Data(:, 1)];
y = [y; accelerometer.Data(:, 2)];
z = [z; accelerometer.Data(:, 3)];
%% next data set
dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'unmoved-with-z-pointing-front-and-x-up');
[accelerometer, ~, ~, ~] = loadData(dataSetFolder);
% Fetch axes
x = [x; accelerometer.Data(:, 1)];
y = [y; accelerometer.Data(:, 2)];
z = [z; accelerometer.Data(:, 3)];
%% next data set
dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'unmoved-with-z-pointing-front-and-y-down');
[accelerometer, ~, ~, ~] = loadData(dataSetFolder);
% Fetch axes
x = [x; accelerometer.Data(:, 1)];
y = [y; accelerometer.Data(:, 2)];
z = [z; accelerometer.Data(:, 3)];
%% next data set
dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'rotate-ccw-around-x-pointing-forward');
[accelerometer, ~, ~, ~] = loadData(dataSetFolder);
% Fetch axes
x = [x; accelerometer.Data(:, 1)];
y = [y; accelerometer.Data(:, 2)];
z = [z; accelerometer.Data(:, 3)];
%% next data set
dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'rotate-ccw-around-y-pointing-left');
[accelerometer, ~, ~, ~] = loadData(dataSetFolder);
% Fetch axes
x = [x; accelerometer.Data(:, 1)];
y = [y; accelerometer.Data(:, 2)];
z = [z; accelerometer.Data(:, 3)];
%% next data set
dataSetFolder = fullfile(fileparts(which(mfilename)), '..' , '..', 'data', 'set-2', 'rotate-ccw-around-z-pointing-up');
[accelerometer, ~, ~, ~] = loadData(dataSetFolder);
% Fetch axes
x = [x; accelerometer.Data(:, 1)];
y = [y; accelerometer.Data(:, 2)];
z = [z; accelerometer.Data(:, 3)];
%% Calibrate sensor
path(fullfile(fileparts(which(mfilename)), 'calibration'), path);
calibrateByEllipseFitting(x, y, z);