Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

polyfit (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: polynomials

Requires: MathScript RT Module

Syntax

[p, s] = polyfit(x, y, n)

[p, s, mu] = polyfit(x, y, n)

Description

Computes a polynomial of a specified degree that fits the input data using the least-squares method.

Examples

Inputs

Name Description
x Specifies the x-coordinates of the data you want to fit. x is a vector.
y Specifies the y-coordinates of the data you want to fit. y is a vector of the same length as x.
n Specifies the degree of the polynomial you want to fit against x and y. n must be less than the length of x. n is a positive integer.

Outputs

Name Description
p Returns the coefficients in descending order of the polynomial fit. p is a vector.
s Returns the Cholesky factor of the Vandermonde matrix.
mu Returns the mean and standard deviation of x. LabVIEW uses these values to normalize x to improve the fit. mu is a vector. The first element of mu is the mean, and the second element of mu is the standard deviation.

Details

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized

Examples

[P, S] = polyfit(1:10, rand(1, 10), 5)

[P, S, MU] = polyfit(1:10, [3, 3, 3, 4, 5, 6, 10, 12, 14, 15], 5)

Related Topics

poly
polyval
roots


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit