-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataRdWr.m
409 lines (385 loc) · 15.3 KB
/
dataRdWr.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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
%% Shu-Tyng Last modified on: Apr, 27, 2017
% Rawdata classification
% Thesis data read
clear; clc; close all; % close all
%% Parameter initialization
ct_fig = 1; % Initial figure counter
plot_en = 1; % Plot if enabled. (2:)
fs = 200; % 50 or 200
rec = [];
rec_data = [];
record = [];
% For SBP decision
rec_pk = [];
rec_pkData = [];
rec_sbp = [];
rec_pkSBP = [];
sbp = [];
locSBP = [];
loc_pk_slopeMax = [];
loc_sbp = [];
pt_sbp = [];
%% File selection
fprintf('Sample rate = %d\n', fs);
drt = '.\Holtek_Rawdata\Thesis_Module Data\';
[filename, drt] = uigetfile([drt, '*.txt'], 'Select a recorded data.');
if isequal(filename,0)
disp('User selected Cancel');
else
disp(['User selected ', fullfile(drt, filename)]);
end
dataroute = fullfile(drt, filename);
fprintf('Data select: %s\n', filename);
%% Read & manage rawdata
% Holtek MCU with Sensor Module + Cuff Module
% Read ECG, PPGcuff, PPGsen, CuffAC, CuffDC, Battery
if (fs == 50) % For files of 50Hz
[time, rECG, PPG1, PPG2, Battery, CuffDC, CuffAC] = textread(dataroute,'%s%d%d%d%d%d%d','headerlines',0);
elseif (fs == 200) % For files of 200Hz
[date, time, rECG, PPG1, PPG2, Battery, CuffDC, CuffAC, record] = textread(dataroute,'%s%s%d%d%d%d%d%d%d','headerlines',0);
else
end
% samplerate = 200; % 200Hz
samples = 1:1:length(time);
% ttime = length(time)/fs; % Total seconds
% pvalue = rawPPG(:,1); % PPG value
rECG = rECG; %* 0.19 * 10^(-6); % 1bit = 0.19uV
PPG1 = PPG1; %* 0.8 * 10^(-3); % 1bit = 0.8mV
PPG2 = PPG2; %* 0.8 * 10^(-3); % 1bit = 0.8mV
CuffDC = (CuffDC - 50.0989) / 0.7157; % CuffDC adjustment
% Set PPGsen & PPGcuff
PPGsen = PPG2; % PPG_sensor
PPGcuff = PPG1; % PPG_cuff
%% PPG peak detection
[pkPPGcuff, locpkPPGcuff, troughPPGcuff, loctroughPPGcuff, prPPGcuff] = PPGpkdec_WH(PPGcuff, fs);
locpkPPGcuff = locpkPPGcuff-35; % Delay shift
for p = 1:length(locpkPPGcuff)
pkPPGcuff(p) = PPGcuff(locpkPPGcuff(p));
end
[pkPPGsen, locpkPPGsen, troughPPGsen, loctroughPPGsen, prPPGsen] = PPGpkdec_WH(PPGsen, fs);
locpkPPGsen = locpkPPGsen-35; % Delay shift
for p = 1:length(locpkPPGsen)
pkPPGsen(p) = PPGsen(locpkPPGsen(p));
end
%% ECG peak detection
% Filtering
% fECG = filter(ecgLPF,rECG);
% ECG = filter(ecgHPF,fECG);
% P&T method
[pkECG, locpkECG, ECGdelay] = pan_tompkin(rECG, fs, 0);
locpkECG = locpkECG + 1; % Delay shift
for n = 1:length(locpkECG)
pkECG(n) = rECG(locpkECG(n));
end
pkECG = pkECG';
locpkECG = locpkECG';
%% SBP decision
[loc_pk_slopeMax, loc_sbp, pt_sbp] = sbpDect(pkPPGcuff, locpkPPGcuff, locpkPPGsen, prPPGsen, CuffDC, fs);
% [loc_pk_slopeMax, loc_sbp, pt_sbp] = sbpDect_v2(pkPPGcuff, locpkPPGcuff, locpkPPGsen, prPPGsen, CuffDC, fs);
%% PTT calculation
[ptt] = PTTcalc(locpkECG, locpkPPGsen);
%% Find CuffDC & CuffAC peaks
[pkCuffDC_max, locpkCuffDC_max] = CuffDCpkdec(CuffDC);
[pkCuffAC, locpkCuffAC, troughCuffAC, loctroughCuffAC, prCuffAC] = PPGpkdec_WH(CuffAC, fs);
locpkCuffAC = locpkCuffAC - 24; % Delay shift
for p = 1:length(locpkCuffAC)
CuffAC(p) = CuffAC(locpkCuffAC(p));
end
%% Find record flag
for i = 1:length(record)
if (record(i) == 1)
rec = [rec; i];
rec_data = [rec_data; rECG(i), -PPGcuff(i), -PPGsen(i), Battery(i), CuffDC(i), CuffAC(i)];
end
end
%% Find loc_pk_slopeMax flag: for deflation start
for i = 1:length(loc_pk_slopeMax)
rec_pk = [rec_pk; locpkPPGcuff(loc_pk_slopeMax(i))];
rec_pkData = [rec_pkData; rECG(rec_pk(i)), -PPGcuff(rec_pk(i)), -PPGsen(rec_pk(i)), Battery(rec_pk(i)), CuffDC(rec_pk(i)), CuffAC(rec_pk(i))];
end
%% Find loc_sbp: for ppg appears
for i = 1:length(loc_sbp)
rec_sbp = [rec_sbp; locpkPPGcuff(loc_sbp(i))];
rec_pkSBP = [rec_pkSBP; rECG(rec_sbp(i)), -PPGcuff(rec_sbp(i)), -PPGsen(rec_sbp(i)), Battery(rec_sbp(i)), CuffDC(rec_sbp(i)), CuffAC(rec_sbp(i))];
end
%% Find pt_sbp: for sbp decision
for i = 1:length(pt_sbp)
sbp = [sbp; pt_sbp(i)];
locSBP = [locSBP; rECG(sbp(i)), -PPGcuff(sbp(i)), -PPGsen(sbp(i)), Battery(sbp(i)), CuffDC(sbp(i)), CuffAC(sbp(i))];
end
%% Plotting
if (plot_en == 1)
%% Fig1. Plot ECG, PPGcuff, PPGsen
x_L = 0;
x_H = inf;
y_L = -inf;
y_H = inf;
figure(ct_fig),
subplot(3,1,1), plot(samples, rECG), hold on, grid on,
plot(locpkECG, pkECG, 'ro'),
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,1)-50 rec_data(f,1)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,1)-50 rec_pkData(f,1)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,1)-50 rec_pkSBP(f,1)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,1)-50 locSBP(f,1)+50], 'g-.', 'LineWidth',2)
end
xlabel ('Time (Samples)'), ylabel ('Voltage (uV)'),...
title ('Rawdata of ECG'), axis ([x_L, x_H, y_L, y_H]),
subplot(3,1,2), plot(samples, -PPGcuff), hold on, grid on,
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,2)-50 rec_data(f,2)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,2)-50 rec_pkData(f,2)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,2)-50 rec_pkSBP(f,2)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,2)-50 locSBP(f,2)+50], 'g-.', 'LineWidth',2)
end
plot(locpkPPGcuff(:,1), -pkPPGcuff(:,1), 'ro'), plot(loctroughPPGcuff, -troughPPGcuff, 'gx'),
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('Rawdata of PPGcuff'), axis ([x_L, x_H, y_L, y_H]),
subplot(3,1,3), plot(samples, -PPGsen), hold on, grid on,
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,3)-50 rec_data(f,3)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,3)-50 rec_pkData(f,3)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,3)-50 rec_pkSBP(f,3)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,3)-50 locSBP(f,3)+50], 'g-.', 'LineWidth',2)
end
plot(locpkPPGsen(:,1), -pkPPGsen(:,1), 'ro'), plot(loctroughPPGsen, -troughPPGsen, 'gx'),
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('Rawdata of PPGsensor'), axis ([x_L, x_H, y_L, y_H]),
ct_fig = ct_fig +1;
% elseif (plot_en == 2)
%% Fig2. Plot CuffDC, PPGcuff, PPGsen
x_L = 1000;
x_H = inf;
y_L = 0;
y_H = inf;
figure(ct_fig),
subplot(4,1,1), plot(samples, CuffDC), hold on, grid on,
plot(locpkCuffDC_max, pkCuffDC_max, 'gx'),
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,5)-50 rec_data(f,5)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,5)-50 rec_pkData(f,5)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,5)-50 rec_pkSBP(f,5)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,5)-50 locSBP(f,5)+50], 'g-.', 'LineWidth',2)
end
xlabel ('Time (Samples)'), ylabel ('Pressure (mmHg)'),...
title ('CuffDC'), axis ([x_L, x_H, y_L, y_H]),
y_L = 1200;
y_H = 2800;
subplot(4,1,2), plot(samples, CuffAC), hold on, grid on,
plot(locpkCuffAC, pkCuffAC, 'ro'),
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,6)-50 rec_data(f,6)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,6)-50 rec_pkData(f,6)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,6)-50 rec_pkSBP(f,6)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,6)-50 locSBP(f,6)+50], 'g-.', 'LineWidth',2)
end
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('CuffAC'), axis ([x_L, x_H, y_L, y_H]),
y_L = -inf;
y_H = inf;
subplot(4,1,3), plot(samples, -PPGcuff), hold on, grid on,
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,2)-50 rec_data(f,2)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,2)-50 rec_pkData(f,2)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,2)-50 rec_pkSBP(f,2)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,2)-50 locSBP(f,2)+50], 'g-.', 'LineWidth',2)
end
plot(locpkPPGcuff(:,1), -pkPPGcuff(:,1), 'ro'), plot(loctroughPPGcuff, -troughPPGcuff, 'gx'),
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('Rawdata of PPGcuff'), axis ([x_L, x_H, y_L, y_H]),
y_L = -inf;
y_H = inf;
subplot(4,1,4), plot(samples, -PPGsen), hold on, grid on,
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,3)-50 rec_data(f,3)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,3)-50 rec_pkData(f,3)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,3)-50 rec_pkSBP(f,3)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,3)-50 locSBP(f,3)+50], 'g-.', 'LineWidth',2)
end
plot(locpkPPGsen(:,1), -pkPPGsen(:,1), 'ro'), plot(loctroughPPGcuff, -troughPPGsen, 'gx'),
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('Rawdata of PPGsensor'), axis ([x_L, x_H, y_L, y_H]),
ct_fig = ct_fig +1;
%% Fig3. Plot CuffDC, CuffAC, Battery
figure(ct_fig),
subplot(3,1,1), hold on, grid on,
[hAx,hLine1,hLine2] = plotyy(samples, CuffDC, samples, CuffAC);
plot(locpkCuffDC_max, pkCuffDC_max, 'ro'), plot(locpkCuffAC, pkCuffAC, 'ro'),
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,5)-50 rec_data(f,5)+50], 'm')
end
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,6)-50 rec_data(f,6)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,5)-50 rec_pkData(f,5)+50], 'm--')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,6)-50 rec_pkData(f,6)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,5)-50 rec_pkSBP(f,5)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,6)-50 rec_pkSBP(f,6)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,5)-50 locSBP(f,5)+50], 'g-.', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,6)-50 locSBP(f,6)+50], 'g-.', 'LineWidth',2)
end
xlabel ('Time (Samples = 200Hz)'),
ylabel (hAx(1),'Cuff pressure (mmHg)'), ylabel (hAx(2),'ADC value'),
title ('CuffDC & CuffAC'),
x_L = -inf;
x_H = inf;
y_L = -inf;
y_H = inf;
subplot(3,1,2), plot(samples, Battery), hold on, grid on,
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,4)-50 rec_data(f,4)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,4)-50 rec_pkData(f,4)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,4)-50 rec_pkSBP(f,4)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,4)-50 locSBP(f,4)+50], 'g-.', 'LineWidth',2)
end
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('Battery'), axis ([x_L, x_H, y_L, y_H]),
subplot(313)
ct_fig = ct_fig +1;
elseif (plot_en == 2)
%% Fig4. Plot CuffDC & CuffAC, ECG, PPGcuff, PPGsensor
figure(ct_fig),
subplot(4,1,1), hold on, grid on,
[hAx,hLine1,hLine2] = plotyy(samples, CuffDC, samples, CuffAC);
plot(locpkCuffDC_max, pkCuffDC_max, 'ro'), plot(locpkCuffAC, pkCuffAC, 'ro'),
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,5)-50 rec_data(f,5)+50], 'm')
end
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,6)-50 rec_data(f,6)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,5)-50 rec_pkData(f,5)+50], 'm--')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,6)-50 rec_pkData(f,6)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,5)-50 rec_pkSBP(f,5)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,6)-50 rec_pkSBP(f,6)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,5)-50 locSBP(f,5)+50], 'g-.', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,6)-50 locSBP(f,6)+50], 'g-.', 'LineWidth',2)
end
xlabel ('Time (Samples = 200Hz)'),
ylabel (hAx(1),'Cuff pressure (mmHg)'), ylabel (hAx(2),'ADC value'),
title ('CuffDC & CuffAC'),
x_L = -inf;
x_H = inf;
y_L = -inf;
y_H = inf;
subplot(4,1,2), plot(samples, rECG), hold on, grid on,
plot(locpkECG, pkECG, 'ro'),
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,1)-50 rec_data(f,1)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,1)-50 rec_pkData(f,1)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,1)-50 rec_pkSBP(f,1)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,1)-50 locSBP(f,1)+50], 'g-.', 'LineWidth',2)
end
xlabel ('Time (Samples)'), ylabel ('Voltage (uV)'),...
title ('Rawdata of ECG'), axis ([x_L, x_H, y_L, y_H]),
subplot(4,1,3), plot(samples, -PPGcuff), hold on, grid on,
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,2)-50 rec_data(f,2)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,2)-50 rec_pkData(f,2)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,2)-50 rec_pkSBP(f,2)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,2)-50 locSBP(f,2)+50], 'g-.', 'LineWidth',2)
end
plot(locpkPPGcuff(:,1), -pkPPGcuff(:,1), 'ro'), plot(loctroughPPGcuff, -troughPPGcuff, 'gx'),
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('Rawdata of PPGcuff'), axis ([x_L, x_H, y_L, y_H]),
subplot(4,1,4), plot(samples, -PPGsen), hold on, grid on,
for f = 1:length(rec)
plot([rec(f,:) rec(f,:)], [rec_data(f,3)-50 rec_data(f,3)+50], 'm')
end
for f = 1:length(rec_pk)
plot([rec_pk(f,:) rec_pk(f,:)], [rec_pkData(f,3)-50 rec_pkData(f,3)+50], 'm--')
end
for f = 1:length(rec_sbp)
plot([rec_sbp(f,:) rec_sbp(f,:)], [rec_pkSBP(f,3)-50 rec_pkSBP(f,3)+50], 'm:', 'LineWidth',2)
end
for f = 1:length(sbp)
plot([sbp(f,:) sbp(f,:)], [locSBP(f,3)-50 locSBP(f,3)+50], 'g-.', 'LineWidth',2)
end
plot(locpkPPGsen(:,1), -pkPPGsen(:,1), 'ro'), plot(loctroughPPGsen, -troughPPGsen, 'gx'),
xlabel ('Time (Samples)'), ylabel ('ADC value'),...
title ('Rawdata of PPGsensor'), axis ([x_L, x_H, y_L, y_H]),
ct_fig = ct_fig +1;
else
end