I am trying to fill in the area between the confidence interval of my pwelch. This is the code I am using:
[px1, f, conf1] = pwelch(det_total_b1,hanning(nfft),round(0.5*nfft),nfft,fs,'ConfidenceLevel',0.95); [px2, f, conf2] = pwelch(det_total_b2,hanning(nfft),round(0.5*nfft),nfft,fs,'ConfidenceLevel',0.95); [px3, f, conf3] = pwelch(det_total_b3,hanning(nfft),round(0.5*nfft),nfft,fs,'ConfidenceLevel',0.95); [px4, f, conf4] = pwelch(det_total_b4,hanning(nfft),round(0.5*nfft),nfft,fs,'ConfidenceLevel',0.95); loglog (f,px1,'Color',[0 204/256 102/256])hold onloglog (f,px2,'Color',[1 102/256 102/256])loglog (f,px3,'Color',[0 128/256 1])loglog (f,px4,'Color',[1 153/256 51/256])patch([f fliplr(f)],[conf1(:,1) fliplr(conf1(:,2))],[0.85 0.85 0.85])set(gca, 'XScale', 'log', 'YScale','log')
But instead of filling the area in gray, what it does is plotting the confidence interval limits as black lines (figure attached). I can't understand why it is doing that.
Thanks for the help in advance!
Best Answer