-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_data.m
More file actions
102 lines (86 loc) · 2.22 KB
/
plot_data.m
File metadata and controls
102 lines (86 loc) · 2.22 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
close all
clear
data = readtable('2_19_test.csv');
time_ranges = readtable('2_19_test_labels.csv','ReadRowNames',true);
time=table2array(data(:,'time'));
x=table2array(data(:,'x'));
y=table2array(data(:,'y'));
z=table2array(data(:,'z'));
us = table2array(data(:,'ultra_sonic'));
us = us - us(1);
us = us/200;
figure(420)
plot(us)
resting = 68:595;
test_2 = 596:2386;
test_3 = 2186:3880;
marissa_row_low = test_2(140:240);
marissa_row_mid = test_2(260:360);
marissa_row_high = test_2(385:485);
marissa_row_no_pause = test_2(510:610);
esther_row_low = test_2(720:940);
esther_row_mid = test_2(990:1190);
esther_row_high = test_2(1210:1380);
esther_row_no_pause = test_2(1440:1590);
figure(69)
plot(z(test_2))
intervals = {marissa_row_low, marissa_row_mid, marissa_row_high, marissa_row_no_pause, esther_row_low, esther_row_mid, esther_row_high, esther_row_no_pause};
figure(1)
hold on
plot(x)
plot(y)
plot(z)
legend({'x_acc','y_acc','z_acc'})
figure(2)
hold on
figure(3)
hold on
figure(4)
hold on
cutoff = 0.06;
for i = 1:4
z_acc{i} = z(intervals{i})-mean(z(intervals{i}));
z_acc{i} = wthresh(z_acc{i},'h', std(z_acc{i}));
z_vel{i} = cumtrapz(time(intervals{i}), z_acc{i});
z_pos{i} = cumtrapz(time(intervals{i}), z_vel{i});
figure(2)
plot(z_vel{i})
figure(3)
plot(z_pos{i})
[pos_low, d] = lowpass(us, cutoff);
pos_high = highpass(z_pos{i}, cutoff);
pos_comp = pos_low(intervals{i}) + pos_high;
figure(4)
plot(pos_comp)
end
figure(5)
hold on
figure(6)
hold on
figure(7)
hold on
for i = 5:8
z_acc{i} = z(intervals{i})-mean(z(intervals{i}));
z_acc{i} = wthresh(z_acc{i},'h', std(z_acc{i}));
z_vel{i} = cumtrapz(time(intervals{i}), z_acc{i});
z_pos{i} = cumtrapz(time(intervals{i}), z_vel{i});
figure(5)
plot(z_vel{i})
figure(6)
plot(z_pos{i})
pos_low = lowpass(us, cutoff);
pos_high = highpass(z_pos{i}, cutoff);
pos_comp = pos_low(intervals{i}) + pos_high;
figure(7)
plot(pos_comp)
end
figure(4)
title('Marissa Rows')
xlabel('samples')
ylabel('position (m)')
legend({'Too little', 'Good weight', 'Too much', 'no pauses'})
figure(7)
title('Esther Rows')
xlabel('samples')
ylabel('position (m)')
legend({'Too little', 'Good weight', 'Too much', 'no pauses'})