% 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,'/Chapter4/Maneuvers'))
addpath(append(main_path,'/Service'))
SAVE_FLAG=0; % saving the figures in a file
% This function plots the signal from the pneuma simulator stored in the
% file CARDIORESPIRATORY1.mat. The variables include: Time, State Drive SI, HR, ABP, Ppl, PaCO2,
% SaO2, Breathing Frequency BF, Tidal Volume Vt,
% Total Ventilatory Drive DTotal
load('CARDIORESPIRATORY1.mat', 'CARDIORESPIRATORY')
plot(CARDIORESPIRATORY(1,:),CARDIORESPIRATORY(9,:))
ylabel('Tidal Volume (l)')
title('Tidal volume during Valsalva and Muller maneuvers')
annonation_save('a)',"Fig4.2a.jpg", SAVE_FLAG);
plot(CARDIORESPIRATORY(1,:),CARDIORESPIRATORY(4,:))
ylabel('Blood pressure (mmHg)')
title('Arterial blood pressure during Valsalva and Muller maneuvers')
annonation_save('c)',"Fig4.2c.jpg", SAVE_FLAG);
plot(CARDIORESPIRATORY(1,:),CARDIORESPIRATORY(3,:))
ylabel('Heart rate (bpm)')
title('Heart rate during Valsalva and Muller maneuvers')
annonation_save('d)',"Fig4.2d.jpg", SAVE_FLAG);
plot(CARDIORESPIRATORY(1,:),CARDIORESPIRATORY(5,:))
title('Pleural Pressure during Valsalva and Muller maneuvers')
plot(CARDIORESPIRATORY(1,:),CARDIORESPIRATORY(6,:))
title('PaCO_2 during Valsalva and Muller maneuvers')
plot(CARDIORESPIRATORY(1,:),CARDIORESPIRATORY(7,:))
title('SaO_2 during Valsalva and Muller maneuvers')
annonation_save('b)',"Fig4.2b.jpg", SAVE_FLAG);
% CARDIO#.mat Cardiovascular System Outputs: Time, Heart Period HP,
% Stroke Volume SV, Cardiac Output CO, TPR and ABP
plot(CARDIO(1,:),CARDIO(4,:))
title('Cardiac Output during Valsalva and Mueller maneuvers')
plot(CARDIO(1,:),CARDIO(3,:))
ylabel('Stroke Volume SV')
title('Stroke Volume SV during Valsalva and Mueller maneuvers')