How to plot confident interval of ecdf() as shade?

7 ビュー (過去 30 日間)
BN
BN 2020 年 8 月 12 日
コメント済み: Star Strider 2020 年 8 月 12 日
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);
I used some of file exchange function such as ciplot but it not work.
Anyone knows how I can achive such a plot? Thanks

採用された回答

Star Strider
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:
.
  2 件のコメント
BN
BN 2020 年 8 月 12 日
Thank you so much. It's awesome.
Star Strider
Star Strider 2020 年 8 月 12 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by