Plot PPG signal and absorption coefficient
Copyright (C) 2022 Miodrag Bolic
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details <https://www.gnu.org/licenses/>.
% Changing the path from main_folder to a particular chapter
main_path=fileparts(which('Main_Content.mlx'));
%addpath(append(main_path,'/Chapter2'))
cd (append(main_path,'/Chapter6/PlotPPG'))
addpath(append(main_path,'/Service'))
SAVE_FLAG=0; % saving the figures in a file
Ploting AC and DC component of the PPG signal
clear_all_but('SAVE_FLAG')
t=1/fs:1/fs:length(b1)/fs;
f1=figure
f1 =
Figure (1) with properties:
Number: 1
Name: ''
Color: [0.9400 0.9400 0.9400]
Position: [681 559 560 420]
Units: 'pixels'
Show all properties
ylabel('Normalized signal obtained at the photodetector', 'FontSize', 10)
xlabel('Time (s)', 'FontSize', 10)
a3=line([0.4 0.4],[0.9 0.9902],'Color','magenta','LineStyle','-.');
a2=line([0.4 0.4],[0.9902 1],'Color','red','LineStyle','--');
%text(0.4,0.945,'\leftarrow DC component')
text(0.4,0.945,{'\leftarrow DC component', ' Non-pulsatile blood', ' De-oxygenated blood', ' Other tissue'})
text(0.4,0.997,'\leftarrow AC component')
%saveas(f1, 'Fig6.1b.jpg')
annonation_save('b)',"Fig6.1b.jpg", SAVE_FLAG);
Ploting the absorption coefficient vs. wavelelngth
a1=loglog(wav,muaoxy); M1="Oxygenated Hb";
a2=loglog(wav,muadeoxy); M2="Deoxygenated Hb";
a3=line([660 660],ylim,'Color','red','LineStyle','--'); M3="660nm";
a4=line([940 940],ylim,'Color','black','LineStyle','--'); M4="940nm";
legend([a1,a2,a3,a4], [M1, M2,M3,M4]);
xlabel('Wavelength (nm)', 'FontSize', 10)
ylabel('Absorption Coefficient (cm^-1)', 'FontSize', 10)
title('The absorption spectrum')
%saveas(f2, 'Fig6.4.jpg')
annonation_save('',"Fig6.4.jpg", SAVE_FLAG);
PPG pulse and the spectrum
clear_all_but('SAVE_FLAG')
a1=rescale1([a;a;a;a;a;a;a;a;a;a]);
a3=line([0.3766 1.3766],[1 1],'Color','magenta','LineStyle','-.');
a2=line([1 2],[0 0],'Color','red','LineStyle','--');
%text(0.4,0.945,'\leftarrow DC component')
text(0.65,0.95,{'\uparrow Peak interval'})
text(1.3,0.05,'\downarrow Onset interval')
%saveas(f3, 'Fig6.6a.jpg')
annonation_save('a)',"Fig6.6a.jpg", SAVE_FLAG);
FResBPM = 0.5; %resolution (bpm) of bins in power spectrum used to determine PR and SNR
N = (60*2*NyquistF)/FResBPM; %number of bins in power spectrum
N = 4096; %2^nextpow2(n);
P1(2:end-1) = 2*P1(2:end-1);
title('Amplitude Spectrum of PPG pulses')
%saveas(f4, 'Fig6.6b.jpg')
annonation_save('b)',"Fig6.6b.jpg", SAVE_FLAG);