calculating and plotting 95% confidence intervals

39 ビュー (過去 30 日間)
Sophia
Sophia 2023 年 9 月 28 日
コメント済み: Sophia 2023 年 9 月 29 日
In the attached figure I plot the daily mean hot temperature. Instead of plotting the standard deviation around the mean, I would like to plot 95% confidence intervals around the mean.
I have attached my current code to make this figure.
Thanks in advance!
run average_temp_question
filename = 'temp_treatment_data'
temptreatmentdata = 2247×3 table
DT HOT COLD ____________________ ______ ______ 22-Apr-2022 14:13:36 24.345 25.03 22-Apr-2022 14:28:36 27.24 27.26 22-Apr-2022 14:43:36 27.24 27.2 22-Apr-2022 14:58:36 26.94 26.875 22-Apr-2022 15:13:36 26.855 27.005 22-Apr-2022 15:28:36 26.915 27.065 22-Apr-2022 15:43:36 26.875 27.005 22-Apr-2022 15:58:36 26.83 27.005 22-Apr-2022 16:13:36 26.66 26.785 22-Apr-2022 16:28:36 26.765 26.895 22-Apr-2022 16:43:36 26.725 26.835 22-Apr-2022 16:58:36 26.68 26.79 22-Apr-2022 17:13:36 26.785 26.875 22-Apr-2022 17:28:36 26.745 26.875 22-Apr-2022 17:43:36 26.745 26.895 22-Apr-2022 17:58:36 26.765 26.895
Unable to resolve the name 'DHW.datetime'.

Error in average_temp_question (line 49)
plot(DHW.datetime, DHW.DHWhot,'LineWidth',1.5, 'LineStyle','-','Color','k')

Error in run (line 99)
evalin('caller', strcat(script, ';'));

採用された回答

Rik
Rik 2023 年 9 月 28 日
A 95% confidence interval means 2 standard deviations on either side. So you simply need to insert *2 in your code.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by