2017-09-12 60 views
2

我密謀與Matlab的數據標準偏差柱狀圖中的以下酒吧情節與標準偏差

y = [0.776 0.707 1.269; 0.749 0.755 1.168; 0.813 0.734 1.270; 0.845 0.844 1.286]; 
std_dev = [0.01 0.055 0.052;0.067 0.119 0.106;0.036 0.077 0.060; 0.029 0.055 0.051]; 

我寫下面的代碼

figure 
hold on 
bar(y) 
errorbar(y,std_dev,'.') 

,但我不是在得到標準差巴正確的位置。

+1

這[文章](https://mathworks.com/matlabcentral/answers/318620-bar-matrix-with-errorbars在同一圖中)可能會有所幫助。但是填寫MATLAB的錯誤報告/功能請求可能是適當的。 – m7913d

+0

對不起,我得到的標準偏差欄不在正確的位置 –

+1

這確實是他們在我提供的鏈接中解決的問題。 – m7913d

回答

1

如果所有的酒吧具有相同的顏色:

x=1:15; 
y = [0.776 0.707 1.269 0 0.749 0.755 1.168 0 0.813 0.734 1.270 0 0.845 0.844 1.286]; 
std_dev = [0.01 0.055 0.052 0 0.067 0.119 0.106 0 0.036 0.077 0.060 0 0.029 0.055 0.051]; 

figure 
hold on 
bar(x,y) 
errorbar(y,std_dev ,'.') 

XTickLabel={'1' ; '2'; '3' ; '4'}; 
XTick=2:4:15 
set(gca, 'XTick',XTick); 
set(gca, 'XTickLabel', XTickLabel); 

enter image description here