function zerooffsetfit=fitted_waveform_leak_latency_subtractor(fit_array)

fitzz=[];
for i=1:size(fit_array,2)
    a=fit_array(:,i);
    lat=a(116)
    lat=cast(lat,'int8')
    a=a-a(115);
    a=a((lat+1):end);
    a=[zeros(30,1);a];
    a=a(1:108);
    r=size(a)
    fitzz=[fitzz a];
    q=size(fitzz)
end

zerooffsetfit=mean(fitzz');