You are here: Symbol Reference > Dew.Stats Namespace > Statistics Class > Statistics Methods > Histogram Method > Histogram Method (TVec, Integer, TVec, TVec, boolean)
Dew Stats for .NET
Contents
PreviousUpNext
Statistics.Histogram Method (TVec, Integer, TVec, TVec, boolean)

Divide the Data vector elements into NumBins equal intervals.

C#
public Histogram(TVec Data, int NumBins, TVec Results, TVec Bins, bool CenterBins);

The number of elements falling in each interval is counted and the result for each interval (frequency distribution) is written to the Results vector. if CenterBins is true then Bins will store bins center points. If CenterBins is false, Bins will store bins edges.The Length and Complex properties of the Results and Bins vectors are adjusted automatically.

Use this version if you need equidistant histogram.

Equal bins -> faster algorithm.

using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
  private void Example()
  {
    Vector Data = new Vector(0);
    Vector Bins = new Vector(0);
    Vector Freq = new Vector(0);
    StatRandom.RandomNormal(-3,0.2,Data); // generate some normaly distributed data
    // Now, divide the data into 15 equal intervals
    Statistics.Histogram(Data,15,Freq,Bins,true);
    // Bins holds the 15 intervals centerpoints
    // and Freq holds the count of elements in each bin
  }
}
What do you think about this topic? Send feedback!
Copyright (c) 1999-2010 by Dew Research. All rights reserved.