% 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/PPG'))
addpath(append(main_path,'/Service'))
SAVE_FLAG=0; % saving the figures in a file
a1=rescale1([a;a;a;a;a;a;a;a;a;a]);
step=floor((1/T)/1000); %1kHz
%a2q(1:step:step*length(a2))=a2;
a2q1 = interp1(1/length(a):1/length(a):10,a1,0:T:10, 'linear','extrap');
Pulse(:,2)=a2q1; % irradiance
Airgap(:,1)=0:T:10; %time;
Airgap(40000:50000,2)=0.195:0.000001:0.205;
Airgap(50001:60001,2)=0.205:-0.000001:0.195;
Airgap(60002:100001,2)=0.195;
plot(simOut.v_out.Time*1e3, -simOut.i_out.Data*1e6)
xlabel('Time (ms)', 'FontSize', 10)
ylabel('Current (µA)', 'FontSize', 10)
subplot(3,2,2),plot(simOut.v_out.Time, simOut.v_out.Data)
xlabel('Time (s)', 'FontSize', 10)
ylabel('Voltage (V)', 'FontSize', 10)
subplot(3,2,4),plot(simOut.v_out.Time, simOut.v_out1.Data)
xlabel('Time (s)', 'FontSize', 10)
ylabel('Voltage (V)', 'FontSize', 10)
subplot(3,2,6),plot(simOut.v_out.Time, simOut.v_out2.Data)
xlabel('Time (s)', 'FontSize', 10)
ylabel('Voltage (V)', 'FontSize', 10)
subplot(3,2,3),plot(Pulse(:,1), Pulse(:,2))
xlabel('Time (s)', 'FontSize', 10)
ylabel('Voltage (V)', 'FontSize', 10)
title('Input pulses scaled to 0V-1V')
subplot(3,2,1),plot(Airgap(:,1), Airgap(:,2))
xlabel('Time (s)', 'FontSize', 10)
ylabel('Depth (mm)', 'FontSize', 10)
exportgraphics(gcf,"Fig6.16.jpg", 'Resolution',600)