# edges_hist_1d

Build one-dimensional histogram of values with unequal bin width and value weights.

## Syntax

h = edges_hist_1d(x, edges)
h = edges_hist_1d(x, edges, w)

## Description

edges_hist_1d builds one-dimensional histogram with bins defined by edges parameter of values x with corresponding weights w. When the w parameter is not given the weight of every value of x is assumed to be 1.

## Parameters

x

Vector of numeric values to put into the histogram.

edges

Sorted vector on numeric values defining the edges of the bins.

w

Vector of numeric values of the weights of corresponding values.

## Return values

h

Vector of length length(edges)-1 of numeric values of the histogram.

## Examples

Build a histogram of the values sequence from 1 to 5 into two-bin histogram.

>> photonscore.edges_hist_1d([1 2 3 4 5], [0 3 10], [1 10 2 3 4])

ans =

11     9

Here the first bin results in 11 because only two values 1 and 2 fall into the interval [0; 3). These values have corresponding weights of 1 and 10 that in sum yields 11. The second bin is the sum of the weights 2, 3 and 4 corresponding to the values 3, 4 and 5. In this example unweighted (e.g. the weight of every value is 1) equivalent of x is:

>> x = [1 ...                   % w = 1
2 2 2 2 2 2 2 2 2 2 ... % w = 10
3 3 ...                 % w = 2
4 4 4 ...               % w = 3
5 5 5 5]                % w = 4

x =

Columns 1 through 11

1     2     2     2     2     2     2     2     2     2     2

Columns 12 through 20

3     3     4     4     4     5     5     5     5

>> photonscore.edges_hist_1d(x, [0 3 10])

ans =

11     9
Copyright © 2019 Photonscore GmbH