Calculating and add the std error bar from the mean values

138 ビュー (過去 30 日間)
Gadelhag M Omar Mohmed
Gadelhag M Omar Mohmed 2022 年 4 月 28 日
編集済み: Scott MacKenzie 2022 年 4 月 28 日
Hi everyone
I have data vector (named: Mean_data) representing the mean of 6 different treatments. I already plotted this Mean_data as a bar graph, but I would like to add the std error bar on the top of each bar. My question is, how can I calculate the std error bar from the mean that I have already got and plot it on the top of each bar.
here is my code and data.
Mean_data=[20.43 8.61 15.37 2.70 29.09 31.59];
% Create figure
figure('Color',[1 1 1]);
% Create axes
axes1 = axes;
hold(axes1,'on');
% Create bar
bar(Mean_data,'DisplayName','Photosynthesis','FaceColor',[0 0 1],...
'BarWidth',0.4);
% Create ylabel
ylabel('µmol m⁻² s⁻¹','FontSize',15);
% Create title
title({'Average of response to each treatment'});
hold(axes1,'off');
% Set the remaining axes properties
set(axes1,'FontSize',12,'FontWeight','bold','XColor',[0 0 0],'XGrid','on',...
'XTick',[1 2 3 4 5 6],'XTickLabel',...
{'treatment1','treatment2','treatment3','treatment4','treatment5','treatment6'},...
'YColor',[0 0 0],'YGrid','on','ZColor',[0 0 0]);
Thanks in advance

採用された回答

Scott MacKenzie
Scott MacKenzie 2022 年 4 月 28 日
編集済み: Scott MacKenzie 2022 年 4 月 28 日
You can't calculate the standard error from the means. You need the raw data. If the raw data (used to calculate the means) are in a matrix M, then the standard error vector is
se = std(M) / sqrt(size(M,1));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by