Matlab:如何在直方图上绘制最大值、最小值和平均值?

Matlab: How to plot max, min and average over a histogram?

我有以下代码可以绘制直方图:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
% 1st GRAPH
figure(2)
hold on
a = connected_sites(:,3);
n = histc(a,1:nr_BBU);
max1 = max(n); % Max. valor
min1 = min(n); % Min. valor
avg1 = mean(n); % Valor medio
std1 = std(n); % Desvi. est??ndar
bar(1:nr_BBU,n)
title('Histogram distribution pool')
plot(1:nr_BBU,max1,'r.' ,'MarkerSize',15) %
set(gca,'XTick',1:nr_BBU)
xlabel('BBU Pool ')
ylabel('N?o of RRHs Connected');
legend({'BBU', 'Max1'},'AutoUpdate','off', 'Location', 'northeast')

我得到了带有最大值指标的所需直方图,但我还想绘制最小值和平均值。

plot


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
figure('Name', 'RRH histogram distribution over BBU')
a = connected_sites(:,3);
n = histc(a,1:nr_BBU); % Calcula la frecuencia de la columna de BBU-conectada
minData = min(n);
maxData = max(n);
meanData = mean(n);

yline(minData, 'r-', 'Minimum')
yline(maxData, 'r-', 'Maximum')
yline(meanData,'r-', 'Mean')
ylim([0, maxData+2])

hold on
bar(1:nr_BBU,n)
title('BBU pools')
set(gca,'XTick',1:nr_BBU) % Para poner el eje X completo con todos los valores
xlabel('BBU Pool ')
ylabel('N?o of RRHs Connected');