I am new to Matlab. I want to display the standard deviation and the mean on a histogram. Can i get Matlab to do this without having to insert the values as text manually?
5 views (last 30 days)
Show older comments
The command legend('text') only seems to accept text inputs, is there a way to make it display the mean and/or standard deviation without me having to enter it?
0 Comments
Answers (1)
José-Luis
on 16 Sep 2016
vals = randn(1000,1);
avg = mean(vals);
h = histogram(vals);
legend({sprintf('mean = %3.2f', avg)})
0 Comments
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!