>> x=round(rand(1,35)*20+1) x = Columns 1 through 18 10 12 18 8 9 9 12 1 18 9 5 14 7 20 12 7 8 17 Columns 19 through 35 4 18 12 4 3 11 8 10 8 1 7 3 20 13 14 9 3 >> xx=sort(x) xx = Columns 1 through 18 1 1 3 3 3 4 4 5 7 7 7 8 8 8 8 9 9 9 Columns 19 through 35 9 10 10 11 12 12 12 12 13 14 14 17 18 18 18 20 20 >> f=find(xx(1:end-1)> g=[0 f 35] g = 0 2 5 7 8 11 15 19 21 22 26 27 29 30 33 35 >> pocet=g(2:end)-g(1:end-1) pocet = 2 3 2 1 3 4 4 2 1 4 1 2 1 3 2 >> xx xx = Columns 1 through 18 1 1 3 3 3 4 4 5 7 7 7 8 8 8 8 9 9 9 Columns 19 through 35 9 10 10 11 12 12 12 12 13 14 14 17 18 18 18 20 20 >> vyskyt=[xx(f) xx(35)] vyskyt = 1 3 4 5 7 8 9 10 11 12 13 14 17 18 20 >> pocet pocet = 2 3 2 1 3 4 4 2 1 4 1 2 1 3 2 >> n=length(vyskyt) n = 15 pocet = 2 3 2 1 3 4 4 2 1 4 1 2 1 3 2 >> vyskyt vyskyt = 1 3 4 5 7 8 9 10 11 12 13 14 17 18 20 >> for i=1:n, plot([vyskyt(i),vyskyt(i+1)],[pocet(i),pocet(i)]),hold on plot([vyskyt(i),vyskyt(i)],[0,pocet(i)]),hold on plot([vyskyt(i+1),vyskyt(i+1)],[pocet(i),0]),hold on end >> shg >> hold off >> axis([0 21 0 4.1]) >> shg