フィルターのクリア

How to mark 95% confidence interval with single bar line - example image

16 ビュー (過去 30 日間)
Harry
Harry 2014 年 7 月 19 日
コメント済み: Paolo 2014 年 8 月 21 日
Hello
I'm using the pwelch method of power spectral density estimate, and would like to indicate the confidence interval like as one single bar - just like in the example image attached. At the moment I just plot the pxxc confidence interval array obtained when calling it in the pwelch function, and its looks very confusing (a lot of noise!). Would much prefer to have something like in the image shown...
Thanks!
  1 件のコメント
Paolo
Paolo 2014 年 8 月 21 日
Hi, I've seen the answer about single bar to represent confidence interval using pwelch. If I well understood the ratio U/L is constant, therefore the logarithm of the confidence interval has constant difference and depends only on M (the range of frequencies). So in theory, whatever power spectra I obtain, the error will be always the same if I use the same M. For instance I could have several spectra in a single plot with a single errorbar. However, if I try the suggested method I obtain different U and L values depending on the data I provide. Am I doing something wrong? Could you help me? Thanks in advance

サインインしてコメントする。

採用された回答

Wayne King
Wayne King 2014 年 7 月 19 日
Do you have the Statistics Toolbox? If so, you can use errorbar()
For example
Fs = 1000;
t = 0:1/Fs:.296;
x = cos(2*pi*t*200)+randn(size(t));
[Pxx,F,Pxxc] = pwelch(x,[],[],[],Fs,'ConfidenceLevel',0.95);
L = mean(10*log10(Pxx)-10*log10(Pxxc(:,1)));
U = mean(10*log10(Pxxc(:,2))-10*log10(Pxx));
plot(F,10*log10(Pxx)); hold on;
errorbar(350,-22,L,U,'ko');
xlabel('Hz'); ylabel('dB');
Note it is important that you plot the PSD estimate in dB because the logarithm is variance-stabilizing for PSD estimate (otherwise the width of the confidence interval is not independent of frequency).
  4 件のコメント
Harry
Harry 2014 年 7 月 31 日
Wayne, I had to bring this up again... So I've been thinking about what you've said, and have an issue. If I can only get the error bar by plotting in dB, then I can't use a semilog y-axis no? This I need because plotting dB is pretty useless for me. Any idea how the graph in the image above must have been plotted? Thanks for your help.
Harry
Harry 2014 年 7 月 31 日
Doesn't matter, I just realised it was a silly question..Thanks again for your help!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeErrorbars についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by