MATLAB HELP STANDARD DEVIATION, MEAN, HISTOGRAMS
Show older comments
PLEASE LEAVE NOTES SO I M
AY UNDERSTAND THE STEPS ON HOW TO FIND THE STANDARD DEVIATION AND MEAN
AY UNDERSTAND THE STEPS ON HOW TO FIND THE STANDARD DEVIATION AND MEANAnswers (2)
Walter Roberson
on 31 Oct 2020
0 votes
mean is mean()
Standard deviation is std()
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);
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);
% 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);
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!