Tutorial 8. Series Functions - Part I
In this tutorial, we will learn about data processing via series
functions. It is recommended that you read the topic Series
Functions before continue.
The Basics
Start the DataScene program and create an empty project with an empty data
table, Table 1. For rows 1 to 101 of Table 1, set two column
formulas "(Row - 1) * (2 * PI) / 100" and "COS(CELL(1))"
for Column 1 and Column 2, respectively. Plot a Line series with Column
1 as the Position component and Column 2 as the Value
component. Select the graph document, Graph 1, as the active document.
You should see a Line series, line1, representing the y=cos(x)
function in the [0, 2p]
range.
Select the Graph: Series Function: Integration menu command to open
the Series Function dialog box. In
the dialog box, check the Generate Data Table check box and then click the Apply button
on the dialog box to apply the
Integrate
series function on line1. DataScene calculates the series function and
plot the destination series line2 in the same graph as the source series line1.
DataScene also generates a data table called Table2(line2: Integrate)
to contain the data of the destination series line2. Close the Series Function dialog box.
As we expect, the destination line2 series is a line of the sine function.

Fig. 1. line2 is the destination series of the Integrate series function
of line1.
Select line2 as the active series and then select the Graph: Series Function: Edit
Function producing line 2 menu command to open the Series Function dialog box.
Switch to the Domain tab-page of the dialog box, uncheck the Always
include all data check box and then start to change the values of the Minimum
and Maximum track bars. You will see two dashed lines are drawn in the graph
indicating the changing series function domain. Click the Apply
button to apply the new domain and note how line2 changes to respond to the new
domain.
Re-check the Always include all data check box to use all data points of line1
in the series function and then click the Apply button. Switch back to the Function tab-page of the Series Function dialog box
and then select Add in the Function Type combo-box and check the
Create New Function radio box. DataScene
refreshes the two list boxes in the Function Source group box. Move both line1
and line2 from the Available list box to the Selected
list box by clicking inside the Available list box and then clicking the
button. The dialog box should look like
that shown in Fig. 2. Click the Apply button to apply the Add series
function on the source series line1 and line2 and
produce the
destination series, line3, in the same graph as the source series.

Fig. 2. Applying the Add series function of line1 and line2 in
the Series Function dialog box.
Close the Series Function dialog box
by clicking its Close button. Change the color of line3 to green so that it
is more visible. Select Table
1 as the active document, change the column formula on Column 2 to "COS(2 *
COL(1))" and apply it. Switch back
to Graph 1, you will see that line2
and line3 have been recalculated automatically in accordance with the
new data in line1.

Fig. 3. line2 and line3 have been recalculated due to the change of
line1.
Now that we have seen how to apply series functions to source series that have
only two
mandatory series components, we will demonstrate
applying series functions to source series with more than two
mandatory series components in the following example.
Close the active project without saving it. Open the file
Examples\Sample Graph\Candle.dts in the DataScene installation folder (which
can be opened by selecting the Help: Demo Projects menu command). Select graph Candle and change the view
dimension to 2D. Execute the Graph: Series Function:
Cubic Spline menu command. On the Series Function dialog box
click the Apply button - a new Line series is produced by cubic-spline
interpolation using values in the Close component of candle1. Click candle1 in the Selected
list box in the Function
Source group box. DataScene adds the Value combo-box to the Function
Source group box and selects Close as its value, indicating the Close
series component of candle1 is used as the value
component of the cubic spline series function.

Fig. 4. Selecting the Value component for the source series in the Series
Function dialog box.
In the Series Function dialog box,
select different values in the Value combo-box and then click the Apply
button. You will see the destination Line series change as the values in the Value
combo-box change. After you finish, close the project without saving it.
FFT Filter
In this section, we will show more utilities of the Series Function dialog box
via an example of the FFT
Filter series function.
Create an empty project and add to it an empty data
table, Table 1. For rows 1 to 101 of Table 1, set two column
formulas "(Row - 1) * (2 * PI) / 100" and "COS(COL(1)) + SIN(2 *
COL(1)) + RND() / 4"
for Column 1 and Column 2, respectively. Plot a Line series,
line1,
with Column
1 as the Position component and Column 2 as the Value
component, respectively.
Select the Series Function: FFT
Filter menu command to open the Series Function dialog box.
Switch to the FFT Filter tab-page of the dialog box, select Band Filter
in the Filter Type combo-box. DataScene adds to the dialog box a tab-page
called Band Filter and automatically switches to it. Click the Apply
button on the dialog box to generate the destination Line series, line2,
which is plotted in the
same graph as line1. Note that the Messages Window springs out with information about the filter function and the built-in freq
variable. Now increase the value in the Lower Factor spin box and observe
how the filter function changes (as shown in the Messages
Window) and how line2 changes - in this case we created a high-pass
band filter. Restore the Lower Factor to 0 and begin to decrease the
value in the Upper Factor spin box and observe the changes of the filter
function and line2 - in this second case we created a low-pass band filter.

Fig. 5. A low-pass band filter on line1 producing line2. The cutoff is 0.08
Nyquist fresuency (7.96 Hz).
Next we will apply a Gaussian filter function. Switch to the FFT
Filter tab-page of the Series Function dialog box
and select User Defined in the Filter Type combo-box. Click the Editor
button to open the Formula Editor. With
the Functions selected in the Library Mode, browse to VOIGT()
in the Library text box and double click it to insert it into the formula.
Select Variables & Parameters in the Library Mode and then
double click freq in the Library to insert it into the formula.
Start typing in the Formula text box and change the formula to "VOIGT(freq - 0.08,
0.02, 0)" - this is a Gaussian function with center value of 0.08 and
variance of 0.02 (refer to the description of the VOIGT function in the Description
text box). Click the OK button of the Formula Editor.
Click the Apply button and then the Close button to close the Series Function dialog box.

Fig. 6. A Gaussian FFT filter applied to line1 produces line2.
Close the opened project without saving it.
See Also
|