calculating and plotting 95% confidence intervals

조회 수: 60 (최근 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 CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by