Data Table Tutorial

Data Table Tutorial

A live version of this calculation is available at EngineeringPaper.xyz.

A video data table tutorial is also available. The data table cell type makes it easy to work with tabular data in EngineeringPaper.xyz. Data can be imported from Excel, CSV, or other spreadsheet file formats. The data can also be exported as a CSV file. To insert a data table cell, click the data table cell icon

. There are two types of columns in a data table, input columns and calculated columns. The first row of a data table contains column names for data columns or query expressions for calculated columns. In the table below, the first two columns are input columns and the last column is a calculated column. The second row contains the units that are applied to every value in the column.

LengthWidthArea=Length*Width=
[m][m][m^2]
1020200
1222264
1424336

Each of the columns, input and output, gets assigned to its variable name as a column vector. For example the Length and Area columns are queried below:

$$ Length= \begin{bmatrix} 10\left\lbrack m\right\rbrack \ 12\left\lbrack m\right\rbrack \ 14\left\lbrack m\right\rbrack \end{bmatrix} $$

$$ Area= \begin{bmatrix} 200\left\lbrack m^2\right\rbrack \ 264\left\lbrack m^2\right\rbrack \ 336\left\lbrack m^2\right\rbrack \end{bmatrix} $$

Since the columns get assigned to vectors, functions that operate on vectors (min, max, average, stdev, etc.) can be used on the column variables. For example the maximum Area and the sum of all of the areas can be determined using the following query statements:

$$ \mathrm{min}\left(Area\right)= 200 \left\lbrack m^2\right\rbrack $$

$$ \mathrm{sum}\left(Area\right)= 800 \left\lbrack m^2\right\rbrack $$

In addition to performing calculations, data tables make it easy to create polynomial least squares fits to data. For example, the following data table fits a line to the provided x and y values. The linear fit can be used by calling the function called Polyfit1 (the function may be renamed by editing the function name field).

x_(points)y_(points)
11.82236506
21.16819656
31.64634224
43.7461875
53.78533977
66.11934925
77.92414076
810.1906023
99.29269577
1011.37309833

The plot below shows the original points as a scatter plot and the linear fit as a parametric plot (see the scatter plots and parametric plots tutorials for more information on defining these types of plots).

The Polyfit1 function that is created can be called like any other function as shown below:

$$ \mathrm{Polyfit1}\left(4\right)= 3.88485663163636 $$

The polynomial fit expression can be obtained by passing an undefined variable to the Polyfit1 function as shown below:

$$ \mathrm{Polyfit1}\left(x\right)= 1.21465008157576 \cdot x - 0.973743694666669 $$

Additionally, linear interpolation between table rows can performed automatically. In the following example, the Interp1 function can be used to provide the absolute viscosity of water as a function of temperature:

T_(points)mu_(points)
[degC][cP]
01.7918
201.0026
500.5471
1000.2817
2000.1346

The viscosity at 10 degrees Celsius between rows 1 and 2 can be obtained by a calling to the Interp1 function as shown below:

$$ \mathrm{Interp1}\left(10\left\lbrack degC\right\rbrack\right.)=\left\lbrack cP\right\rbrack =1.3972 \left\lbrack cP\right\rbrack $$

The following plot shows the points from the viscosity table above along with the Interp1 function showing the linear interpolation:

The range function is useful for initializing sequences of values in a data table. Calling range with one input creates a sequence that starts with 1 and ends with the provided value. Calling range with two inputs uses the first input as the starting value and the second value as the stopping value and increments the values by 1. Finally, calling range with three values uses the inputs as the starting value, stopping value, and increment value, in that order. See the example below:

Col1=range(5)=Col2=range(-2,2)range(0.2,1,0.2)=Sum=Col1+Col2
1-20.2-1
2-10.41
300.63
410.85
5217

In the above example, the first two columns are assigned to the variable names Col1 and _Col2. _This allows the sum to be calculated in the last column using these two columns. The third column is set to range(0.2,1,0.2) but is not assigned to a variable so it cannot be used in other calculations. When assigning the calculation to a variable, the trailing equals sign is optional, as shown in the second column.