The QtiPlot Handbook
Prev | Chapter 5. The Dialogs | Next

# Add Function

This dialog box is used to add a function curve to the active plot. The plotted function is built with the common operators *, +, /, -, and ^ (for multiplication, addition, division, subtraction and exponentiation, respectively). A complete set of intrinsic functions are available and these are listed in the muParser section of the chapter on Mathematical Expressions and Scripting.

The first item is the Curve Type and is used to select the form of the generator function. The simplest and most common function definition is the classical Cartesian coordinate definition, y=f(x). This is the default option and is simply named "Function". Just below this is a text pane in which to enter the function definition, The next two parameters are used to select the X-range to be used for the plot. The last parameter sets the number of data points to be computed in the selected X-range. At the very bottom is a "Function Selector" which contains a dropdown list of intrinsic functions and brief description of the function. Clicking on the Add Function button will copy the selected function into the function definition pane.

Figure 5-4. The Add Function... dialog box: Cartesian Coordinates.

If the function expression contains terms that are recognizable as constants, e.g.: f(x) = a*x + b, QtiPlot will detect them and display a two column table on the right side of the dialog which contains input spin boxes that simplify setting appropriate values for the detected constants.

Figure 5-5. The Add Function... Dialog Box: Automatic Detection of Constants.

linkend=

A function can also be defined using a parametric definition by selecting "Parametric plot" as the Curve type. That is, given some variable, m, the (x,y) data points are computed using functions of that variable, x=f(m) and y=g(m).

The first parameter is the name of the parametric variable (here m). It is followed by the definitions of the two functions, the range of the parametric variable, and the number of data points.

Figure 5-6. The Add Function... dialog box: Parametric Coordinates.

Finally, a polar definition of the function may be used by selecting "Polar plot" as the Curve type. Given some variable t, then the radius (R) and angle (Theta) are computed using two functions of that variable, R=f(t) and Theta=g(t), in a manner similar to the parametric function case. The (x,y) data points are then computed as x=R*cos(Theta) and y=R*sin(Theta).

The first parameter is the name of the parametric variable (here t). It is followed by the definition of the two functions, the range of the parametric variable, and the number of data points. Note that the angle is in radians. pi is an internally defined constant which can be used in any mathematical expression. For example, you can use 3*pi to define the parameter range.

Figure 5-7. The Add Function... dialog box: Polar Coordinates.

Prev | Home | Next
Add Error bars | Up | Add Layer