least_squares


Synopsis

fit a polynomial of specified order using the least squares method

Input Ports

in_field

Grid+Node_Data+Scalar (must be 1D)

ui_parent

user interface parent object

 

Output Ports

out_coeff

double[order+1]

out_fld

Grid+Node_Data

out_obj

output renderable object

 

Description

least_squares fits a polynomial of a given order to an input data set. The input consist of (x, y) pairs, where the X's are the 1D mesh coordinates of the nodes, and the Y's are the node_data values. These points are fit to a polynomial of the desired degree. Two outputs are produced; out_coeff is an array containing the n+1 coefficients of the resulting polynomial, and out_fld is the fit Y values computed by evaluating the polynomial at each X point.

Input Ports

in_field

Grid+Node_Data+Scalar. 1D field containing data to fit.

ui_parent

A port to connect to a user interface object that contains the module's widgets. By default, it is connected to the default user interface object in the application in which the macro is instanced. (This default connection is not drawn.)

Parameters

data component

UIradioBoxLabel. Which component of the data to fit to the polynomial.

polynom order

UIslider. Order of the polynomial to fit to the data--1=linear, 2=quadratic, and so on.

Output Ports

out_coeff

double[order+1]. The coefficients of the resulting polynomial, in order from least significant (constant term) to most significant (highest power).

out_fld

Mesh+Node_Data. Node_Data values are the polynomial evaluated at the points on the mesh.

out_obj

Renderable object corresponding to out_fld.

Example

Not available.

File

v/modules.v

See also

Not applicable.