Continuous error bar across the x
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all, i want to plot the mean of a data measurment with the standard deviation. I tried using boundedline but it is not working. I have just one value (y value) with the standard error to plot across the x values. can someone know how to do it.
댓글 수: 0
답변 (1개)
DGM
2022년 11월 15일
What about boundedline doesn't work? If you specify y as a constant-valued vector, I don't see why it wouldn't work.
You could always just use patch() or similar.
% some fake data
x = 0:99; % or whatever x means here
err = 0.5 + 0.2*rand(1,100); % some error
err = smoothdata(err,'movmean',20); % make it smooth for the demo
y = 12.4; % some constant y-level
% boundary curves
yu = y + err;
yl = y - err;
% plot the things
yline(y);
hold on
hp = patch([x fliplr(x)],[yu fliplr(yl)],'b');
hp.FaceAlpha = 0.2;
hp.EdgeAlpha = 0;
plot(x,yu,'k--')
plot(x,yl,'k--')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!