%ex37 % filter out the equipment artifact at about 0.7 to1.2 Hz, lpFilt = designfilt('lowpassfir','PassbandFrequency',0.001, ... 'StopbandFrequency',0.0014,'PassbandRipple',0.5, ... 'StopbandAttenuation',65,'DesignMethod','kaiserwin'); T1=T0; for i=2:3 T1.(i)=filtfilt(lpFilt,T1.(i)); end %LineWidth set(groot,'defaultLineLineWidth',1) % plot(T.Time,T.s01,'DisplayName','rST21'); % plot(T.Time,T.s02,'DisplayName','rST21 +6mm'); T=T1; figure plot(T.Time,T.s01,'DisplayName','rST21'); hold on; % yyaxis right; % plot(T.Time,T.s02,'DisplayName','rST21 +6mm'); % hold on; yyaxis left xlabel('Time (seconds)') ylabel('Impedance at 40kHz (k\Omega)') legend('show', 'Location', 'northwest') grid title('Subject A, right ST-21 and +6mm; lowpass filter at 0.7Hz') yyaxis right marker=300.177; x=[marker,marker]; y=[0,6]; plot(x,y,'--','Color',[0.277 0.473 0.098],'DisplayName','hold breath1'); marker=312.938; x=[marker,marker]; y=[0,6]; plot(x,y,'--','Color',[0.277 0.473 0.098],'DisplayName','finish1'); % closeup box axes('position',[.65 .175 .25 .25]) box on % put box around new pair of axes indexOfInterest = (T.Time > 291) & (T.Time < 326); % range of t near perturbation plot(T.Time(indexOfInterest),T.s01(indexOfInterest)) % plot on new axes hold on axis([291 326 2.463 2.477 ]) title('Close-up of trace while holding breath') grid yyaxis right marker=300.177; x=[marker,marker]; y=[2.4,2.5]; plot(x,y,'--','Color',[0.277 0.473 0.098],'DisplayName','hold breath'); marker=312.938; x=[marker,marker]; y=[2.4,2.5]; plot(x,y,'--','Color',[0.277 0.473 0.098],'DisplayName','finish'); % ===== peaks [R21pks,R21locs] = findpeaks(T.s01); R21locs=R21locs/1000;