# 如何在Matlab中的正态分布图上细化y轴？

##### 问题描述投票：0回答：1

Image of normal distribution plot

``````function [M,m,ave,med,dev,v1]=GradeStatistics
% This program accepts grades and gives the maximum, minimum,average(mean),
% median, standard deviation and also sorts the grades for the user.
% This program was written by Jacob
disp('Enter a vector containing all grades using square brackets')
M=max(v);m=min(v);ave=mean(v);med=median(v);dev=std(v);
v1=sort(v);H={'max';'min';'mean';'median';'std'};
G={M;m;ave;med;dev};clc;disp(table(H,G));
All={'max',M;'min',m;'mean',ave;'median',med;'std',dev};

disp('Would you like to see a normal distribution?')
Case = input('Enter Y for yes or N for No=','s');
if lower(Case)=='y'
f=(1/(dev*sqrt(2*pi)))*exp(-0.5*((v1-ave)/dev).^2);
xlabel('Score');ylabel('Students')
elseif lower(Case)=='n'
end
``````

matlab
1

## 代码调整

``````clc;clear;close all;format compact;help GradeStatistics;
``````

``````function [M,m,ave,med,dev,v1] = GradeStatistics
% This program accepts grades and gives the maximum, minimum,average(mean),
% median, standard deviation and also sorts the grades for the user.
% This program was written by Jacob
disp('Enter a vector containing all grades using square brackets')
M=max(v);
m=min(v);
ave=mean(v);
med=median(v);
dev=std(v);
v1=sort(v);
H={'max'; 'min'; 'mean'; 'median'; 'std'};
G={M; m; ave; med; dev};
disp(table(H, G));
All={'max',M; 'min',m; 'mean',ave; 'median',med; 'std',dev};
VV1={'sort', v1};

disp('Would you like to see a normal distribution?')
Case = input('Enter Y for yes or N for No=','s');
if lower(Case) == 'y'
f=(1/(dev*sqrt(2*pi)))*exp(-0.5*((v1-ave)/dev).^2);
plot(v1, f);
xlabel('Score');
ylabel('Students')
elseif lower(Case) == 'n'
end
``````

## 修复情节

``````% Display Histogram
figure
histogram(v, 10);