Dataset Calculation

Dataset Calculation is used to perform calculations on existing Datasets, in order to create new Datasets.
For example, you might want to make these new Datasets:
Distance a wheel has travelled = Circumference of the wheel x Motor Rotations
Average light intensity = (Color Sensor 1 (Ambient Light Intensity) + Color Sensor 2 (Ambient Light Intensity)) divided by 2
Closest object = Minimum value of Ultrasonic Sensor 1, Ultrasonic Sensor 2, and Ultrasonic Sensor 3
In each case, you take one or more existing Datasets, and perform mathematical functions to create a new Dataset. See (Formula Field) for more.

You can open Dataset Calculation by clicking the Dataset Calculation tab.



Dataset Calculation tab
Formula Field
Calculated Dataset Name
Calculated Dataset Unit
Calculate
Functions List
Datasets
Formula Field
The Formula Field is used to create an equation to generate the new Dataset. The Datasets you collect may have different names.
This table gives the equations for the examples above.
New DatasetFormula
Distance a wheel has travelled
(assuming 17.5 cm circumference)
Motor_Rotation _pB *17.5
Average Light Intensity of two Color SensorsAvg(Color_Sensor_p3; Color_Sensor_p2) OR
(Color_Sensor_p3 + Color_Sensor_p2) / 2
Closest objectMin(Ultrasonic_Sensor_pB; Ultrasonic_Sensor_pC; Ultrasonic_Sensor_pD)
Calculated Dataset Name
This is the ID of your dataset. You can rename your calculated dataset to something more meaningful.
Calculated Dataset Unit
Give your new Dataset a unit of measurement. For example, the distance travelled may be centimeters.
Calculate
Once a formula has been created in the Formula Field, click Calculate to generate a new Dataset and place it on the Graph Area. This Dataset will be given its own Y-Axis. You can change the Color and Plot Style using the Dataset Table tab.
Functions List
Functions can be used to perform calculations on your Datasets.
Function NameFunction termDefinition
Add+Add a constant or another datasets to the original
Subtract-Subtract a constant or another datasets from the original
Multiply*Multiply a dataset by a constant or another dataset
Divide\Divide a dataset by a constant or another dataset
Absolute ValueAbsReturns the absolute value of the specified number
AverageAvgReturns the average value of all the specified datasets
FloorFloorReturns the largest whole number less than or equal to the specified number
CeilingCeilReturns the smallest whole number greater than or equal to the specified number
MinimumMinReturns the smaller of the specified set of numbers
MaximumMaxReturns the larger of the specified set of numbers
RoundRoundReturns the number nearest the specified value
Square RootSqrtReturns the square root of the specified number
SineSinReturns the sine of the specified number
CosineCosReturns the cosine of the specified number
TangentTanReturns the tangent of the specified number
Inverse Tangent2Atan2Returns the angle whose tangent is the quotient of two specified numbers
Natural LogarithmLnReturns the natural logarithm of the specified number
Common LogarithmLogReturns the base 10 logarithm of the specified number
DerivativeSlopeMeasures how the specified function changes as its input changes
The Average, Minimum, and Maximum functions can accept multiple datasets, as shown here:

Avg(dataset1; dataset2; dataset3)
Tips and Tricks
The function calculation is repeated using the Y-Axis Value(s) for each X-Axis point. This creates a new set of Y-Axis Values (the Calculated Dataset). See the example below.
Example

If you have two datasets, generated by measuring the Motor Rotations for the motors on Port B and Port C every 10 seconds for 30 seconds, the datasets may contain the following data:
0 seconds10 seconds20 seconds30 seconds
Motor Rotations, Port B0134
Motor Rotations, Port C0257
Using the Average, Add and Multiply functions on the two datasets will generate the following Calculated Datasets:
0 seconds10 seconds20 seconds30 seconds
Average Motor Rotations01.545.5
Motor Rotations, Port B + Motor Rotations, Port C03811
Motor Rotations, Port B * 1.501.54.56
Datasets
This list shows the Datasets available for use in the Dataset Calculation. Click on a Dataset from this list to automatically insert it into the Formula Field.
Dataset Calculation
Quick links