function plotCVtimeseries(tCV,CV,t,medCV,iqr,nlog,tend)


figure;hold on;
set(gcf,'units','centimeters','outerposition',[2 1 10 10],'color','white');

% plot CV of individual peaks and 10s median CV
s1=scatter(tCV,CV,'Marker','o','SizeData',1,'MarkerFaceAlpha',.5,'MarkerFaceColor',[0.3 0.3 0.3],'MarkerEdgeColor','none');
s2=scatter(t-5,medCV,'Marker','^','SizeData',15, 'MarkerFaceColor',[1 0 0],'MarkerEdgeColor','none');

% inter quartile range of 10s median CV
f=fill([0, t', fliplr(t'), 0], [iqr(1,1), iqr(:,1)', fliplr(iqr(:,2)'), iqr(1,2)], [0.7 0.7 0.7]);
set(f,'facealpha',.7,'EdgeColor','none');

% legend
leg=legend([s1,s2,f],{'Matched peaks (R>0.9)','Median PeakCV (10s)','Interquartile range'},'Location','southeast', 'FontSize',8);

% labels etc.
ylabel('CV (m/s)');xlim([0 t(end)]);ylim([0 8]);xlabel('Time (s)');
text(0.015*tend,.55,['(',num2str(min(nlog)),'-',num2str(max(nlog)),')'],'FontSize',8,'Color',[1 0 0]);
uistack(f,'bottom')
yticks(0:8);xticks(0:round(tend/5):tend);
set(gca, 'box','on','FontSize',8,'Layer','top','YColor', [0 0 0],'XColor', [0 0 0]);

end
   
    
    
    