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

var (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: statistics

Requires: MathScript RT Module

Syntax

y = var(x)

y = var(x, w)

y = var(x, w, d)

Description

Computes the variance of the input elements. This function works column-wise for matrices by default.

Details

Examples

Inputs

Name Description
x Specifies a matrix.
w Specifies a weight. w is a vector.
d Specifies the dimension of x across which to compute the variance if x is a matrix. d is a scalar that accepts the following values.

1 (default) Computes the variance by column.
2 Computes the variance by row.

Outputs

Name Description
y Returns the variance of x. y is a scalar or vector.

Details

w can be in one of the following three states:
  • If x is a vector, w is a vector of the same size as x. If x is a matrix, w is a vector of the same size as the dimension of x across which to compute the variance. All elements in w must be greater than 0. LabVIEW normalizes w so the sum of all the elements in w is equal to 1.
  • w is a vector with only one element, 1. The input matrix has no weight. LabVIEW normalizes the output by the length of the input matrix.
  • w is a vector with only one element, 0, or w is an empty matrix. The input matrix has no weight. LabVIEW normalizes the output by the length of the input matrix minus one.

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

X = [1, 2, 3, 4, 5, 6; 2, 4, 6, 8, 10, 12]
Y = var(X)

Related Topics

std


 

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