

figure(1)
subplot(2,2,1)
plot(time,newWaves(:,:,1));
title('Channel 1')
ylabel('Voltage (V)')
xlabel('time (seconds)')

subplot(2,2,2)
plot(time,newWaves(:,:,2))
title('Channel 2')
ylabel('Voltage (V)')
xlabel('time (seconds)')

subplot(2,2,3)
plot(time,newWaves(:,:,3))
title('Channel 3')
ylabel('Voltage (V)')
xlabel('time (seconds)')

subplot(2,2,4)
plot(time,newWaves(:,:,4))
title('Channel 4')
ylabel('Voltage (V)')
xlabel('time (seconds)')


figure(2)
subplot(2,2,1)
scatter(Vmaxs(:,1),amplifications(:,1),1);
title('Channel 1: Gain v Voltage')
ylabel('Gain')
xlabel('Signal Max')

subplot(2,2,2)
scatter(Vmaxs(:,2),amplifications(:,2),1);
title('Channel 2: Gain v Voltage')
ylabel('Gain')
xlabel('Signal Max')

subplot(2,2,3)
scatter(Vmaxs(:,3),amplifications(:,3),1);
title('Channel 3: Gain v Voltage')
ylabel('Gain')
xlabel('Signal Max')

subplot(2,2,4)
scatter(Vmaxs(:,1)+Vmaxs(:,2)+Vmaxs(:,3)+Vmaxs(:,4),amplifications(:,5),1);
title('Sum of all channels: Gain v Voltage')
ylabel('Gain')
xlabel('Signal Max')

if( flat == 1 )
    figure(3)
    plot(time,flattops(:,:,2))
    title('Fails flat top');
    xlabel('time (seconds)');
    ylabel('Voltage (V)');
end

figure(4)
plot(time,DBLbadwaves(:,:,2))
title('Has double pulses');
xlabel('time (seconds)');
ylabel('Voltage (V)');

[~,ll,~] = size(RTFWHMbadwaves);
if( ll > 0 )
    figure(5)
    plot(time,RTFWHMbadwaves(:,:,2))
    title('Rise time or FWHM not met');
    xlabel('time (seconds)');
    ylabel('Voltage (V)');
end

[~,ll,~] = size(DHwaves);
if( ll > 0 )
    figure(6)
    plot(time,DHwaves(:,:,2))
    title('Fails double hump cut');
    xlabel('time (seconds)');
    ylabel('Voltage (V)');
end
