How can i draw Confidence interval graph for my data?...(i'm beginner)

조회 수: 13 (최근 30일)
Bluemin
Bluemin 2021년 3월 26일
답변: Bjorn Gustavsson 2021년 3월 26일
I used this code ...
x = 1:100; % Create Independent Variable
y = randn(50,100); % Create Dependent Variable ‘Experiments’ Data
N = size(y,1); % Number of ‘Experiments’ In Data Set
yMean = mean(y); % Mean Of All Experiments At Each Value Of ‘x’
ySEM = std(y)/sqrt(N); % Compute ‘Standard Error Of The Mean’ Of All Experiments At Each Value Of ‘x’
CI95 = tinv([0.025 0.975], N-1); % Calculate 95% Probability Intervals Of t-Distribution
yCI95 = bsxfun(@times, ySEM, CI95(:)); % Calculate 95% Confidence Intervals Of All Experiments At Each Value Of ‘x’
figure
plot(x, yMean) % Plot Mean Of All Experiments
hold on
plot(x, yCI95+yMean) % Plot 95% Confidence Intervals Of All Experiments
hold off
grid
and then I want to draw graph.. like this..
so, Someone gave me the code
Replace the second plot call with
patch([x, fliplr(x)], [yCI95(1,:) fliplr(yCI95(2,:))], 'b', 'EdgeColor','none', 'FaceAlpha',0.25)
like this picture...
q1 ) Is this a certain confidence interval graph correct? I think that It is very different from the original data picture
this is original graph
q2 ) and then How do I draw a confidence interval graph using my data? my data is uploaded
plz help me..

답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2021년 3월 26일
The second graph is certainly not correct - since it is centred around zero and not around the average at each point, you have to add that t your confidence intervalls. For neat plots like this there are a number contributions on the file exchange: confplot, errorfill, boundedline, shaded-error-bar-yy, fillplot-mat, errorshade, shadederrorbar, shplot and more.
HTH

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by