I am trying to plot frequency spectra with 95% confidence intervals (upper and lower bounds). I am using pwelch to calculate power spectra then plotting using loglog. But so far I can only figure out how to plot the confidence intervals at line. I would like to shade the intervals instead. I think I could do so by shading between the power line and the confidence interval lines. Any ideas? This is my current code and I have attached a figure.
Thank you!
figure
clear PxxU F PxxC; [PxxU,F,PxxC] = pwelch(detrend(fixgaps(PK1.zavg_pE(j,pkperiod))),[],[],nfft,288);
h=loglog(F,PxxU,F,PxxC,'--','color','k');
%h=loglog(F,PxxU);
hold on
grid on
set(gca,'fontsize',20)
xlabel('f (cpd)','fontsize',20)
ylabel('S_{along} (days)','fontsize',20)
title('Alongshore Velocity');
set(gca,'fontsize',16)
xlim([.1 10])
% legend('PK','PO','location','southwest')
legend('PK','PK upper','PK lower','location','southwest')