vertical lines of 'mean' and 'std' in a 'ksdensity' plot?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Fercho_Sala
am 31 Mai 2021
Kommentiert: Fercho_Sala
am 1 Jun. 2021
Hello everyone. I was wondering how can I add vertical lines of standard deviation, mean, median , among other statistical results to a plot made with the function ‘ksdensity’ ? thank you.
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 31 Mai 2021
Use xline.
% create a distribution with known mean, std
pd = makedist('Normal','mu',2.5,'sigma',3.1);
x = random(pd,100,1);
[f,xi] = ksdensity(x);
figure
plot(xi,f);
% Add vertical lines
xline(2.5)
xline(2.5+[-3.1,3.1])
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!