How to plot confident interval of ecdf() as shade?
조회 수: 7 (최근 30일)
이전 댓글 표시
Hello all,
I used ecdf() to plot my data, it calculates upper and lower band, but I don't know how to plot them like this:
a = rand(30,1);
[f1,x1,up,low] = ecdf(a);
Anyone knows how I can achive such a plot? Thanks
댓글 수: 0
채택된 답변
Star Strider
2020년 8월 12일
Try this:
a = rand(30,1);
[f1,x1,up,low] = ecdf(a);
idx = ~isnan(up) & ~isnan(low);
figure
plot(x1(idx), f1(idx), '-r')
hold on
patch([x1(idx); flipud(x1(idx))], [up(idx); flipud(low(idx))], 'b', 'FaceAlpha',0.25, 'EdgeColor','none')
hold off
grid
legend('f1', '95% Confidence Interval', 'Location','SE')
The data are random, so for example for one run:
.
추가 답변 (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!