![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/345042/image.png)
How to plot confident interval of ecdf() as shade?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
BN
el 12 de Ag. de 2020
Comentada: Star Strider
el 12 de Ag. de 2020
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/344910/image.png)
a = rand(30,1);
[f1,x1,up,low] = ecdf(a);
Anyone knows how I can achive such a plot? Thanks
0 comentarios
Respuesta aceptada
Star Strider
el 12 de Ag. de 2020
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/345042/image.png)
.
2 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!