MATLAB HELP STANDARD DEVIATION, MEAN, HISTOGRAMS

6 views (last 30 days)
PLEASE LEAVE NOTES SO I MAY UNDERSTAND THE STEPS ON HOW TO FIND THE STANDARD DEVIATION AND MEAN

Answers (2)

Walter Roberson
Walter Roberson on 31 Oct 2020
mean is mean()
Standard deviation is std()

Meg Noah
Meg Noah on 5 Aug 2025
Try this:
force_lbs = [243,236,389,628,143,417,205,404,464,605,137,123,372,439,...
497,500,535,577,441,231,675,132,196,217,660,569,865,725,547,347];
mean_lbs = mean(force_lbs);
std_lbs = std(force_lbs);
fprintf(1,'Mean force = %f [lbs]\nStandard Deviation force=%f [lbs]\n' ,...
mean_lbs,std_lbs);
Mean force = 417.300000 [lbs] Standard Deviation force=199.789743 [lbs]
edges_lbs = linspace(-3*std_lbs+mean_lbs,3*std_lbs+mean_lbs,13);
histogram(force_lbs,edges_lbs);
% 68% of the population is approx within 1 standard deviation of the mean
x = norminv([(1-0.68)/2 (1-0.68)/2+0.68]);
upper_limit_68 = mean_lbs + x(2)*std_lbs;
lower_limit_68 = mean_lbs + x(1)*std_lbs;
percentage_in_limit_68 = 100* ...
sum(lower_limit_68 <= force_lbs & force_lbs <= upper_limit_68)/numel(force_lbs);
fprintf(1,'%.4f%s are within the normal 68%s limits [%.4f,%.4f] lbs\n', ...
percentage_in_limit_68, ...
'%','%',lower_limit_68,upper_limit_68);
60.0000% are within the normal 68% limits [218.6175,615.9825] lbs
% 96% of the population is approx within 2.1 standard deviation of the mean
x = norminv([(1-0.96)/2 (1-0.96)/2+0.96]);
upper_limit_96 = mean_lbs + x(2)*std_lbs;
lower_limit_96 = mean_lbs + x(1)*std_lbs;
percentage_in_limit_96 = 100* ...
sum(lower_limit_96 <= force_lbs & force_lbs <= upper_limit_96)/numel(force_lbs);
fprintf(1,'%.4f%s are within the normal 96%s limits [%.4f,%.4f] lbs\n', ...
percentage_in_limit_96, ...
'%','%',lower_limit_96,upper_limit_96);
96.6667% are within the normal 96% limits [6.9820,827.6180] lbs

Community Treasure Hunt

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

Start Hunting!