Skip to content

Histogram

Alexius Wadell edited this page Jan 17, 2017 · 4 revisions

Syntax

ds.Histogram(ChannelName, [minValue, maxValue])

ds.Histogram(__, Name, Value)

Description

ds.Histogram(ChannelName, [minValue, maxValue]) creates a histogram plot of the values logged under ChannelName in the supplied datasources between the minValue and maxValue.

ds.Histogram(__, Name, Value) Additional optional parameters can be passed to the Histogram using Name-Value pairs

Input Arguments

ChannelName

The name of the channel used to generate the histogram plot. For a list of possible channel see allLogged.

[minValue, maxValue]

Histogram will only look at values between the minValue and maxValue, samples outside of that range will be ignored.

It is recommended to start with a range significantly larger than the anticipated range. Once an initial histogram has been generated, further refinements can be made to the values of minValue and maxValue as needed.

Name-Value Pair Arguments

'unit' -- Unit System

Sets the units used to report the channel values - See getChannel

'nBins' -- Number of Bins

Number of bins used to generate the histogram, specified as a positive integer. Defaults to 50 bins.

'Normalization' -- Type of Normalization

Normalization methods used, specified to one of following:

Normalization Description
'count' The height of each bar is the number of observations in each bin
'probability' The height of each bar is the number of observations in each bin divided by the total number of observations. The sum of the bars height's is one
'pdf' Default Normalization. The height of each bar is (number of observations) / (total observations * width of bin). The sum of the bars area is one.

Examples

Goal: Generate a histogram of longitudinal acceleration using datasources from the 2016 FSAE Michigan competition.

First poll Datamaster for datasources from the competition

dm = Datamaster;

%Get Datasource that occurred during the competition (May 10-15th 2016)
ds = dm.getDatasource('StartDate', '2016-05-10', 'EndDate', '2016-05-15');

Using dm.allLogged, we find that the channel for longitudinal acceleration is called 'G_Force_Long'. Let's uses [-2, 2] for [minValue, maxValue], as we can be reasonable certain that longitudinal acceleration will be less than 2G. Finally, set 'unit' to 'G' so that the data stored in 'G_Force_Long' is returned using units of 'G' and not using the SI units.

figure 								%Create a new figure for plotting
ds.Histogram('G_Force_Long',...		%The channel name used to log longitudinal acceleration
			 [-2, 2], 'unit', 'G')	%We expect longitudinal acceleration to be less than 2G

Full Script

dm = Datamaster;

%Get Datasource that occurred during the competition (May 10-15th 2016)
ds = dm.getDatasource('StartDate', '2016-05-10', 'EndDate', '2016-05-15');

figure 								%Create a new figure for plotting
ds.Histogram('G_Force_Long',...		%The channel name used to log longitudinal acceleration
			 [-2, 2], 'unit', 'G');	%We expect longitudinal acceleration to be less than 2G