- Scilab Help
- Compatibility Functions
- firstnonsingleton
- mstr2sci
- mtlb_0
- mtlb_a
- mtlb_all
- mtlb_any
- mtlb_axis
- mtlb_beta
- mtlb_box
- mtlb_close
- mtlb_colordef
- mtlb_cumprod
- mtlb_cumsum
- mtlb_dec2hex
- mtlb_delete
- mtlb_diag
- mtlb_diff
- mtlb_dir
- mtlb_double
- mtlb_e
- mtlb_echo
- mtlb_eval
- mtlb_exist
- mtlb_eye
- mtlb_false
- mtlb_fft
- mtlb_fftshift
- mtlb_find
- mtlb_findstr
- mtlb_fliplr
- mtlb_fopen
- mtlb_format
- mtlb_fprintf
- mtlb_fread
- mtlb_fscanf
- mtlb_full
- mtlb_fwrite
- mtlb_grid
- mtlb_hold
- mtlb_i
- mtlb_ifft
- mtlb_imp
- mtlb_int16
- mtlb_int32
- mtlb_int8
- mtlb_is
- mtlb_isa
- mtlb_isfield
- mtlb_isletter
- mtlb_isspace
- mtlb_l
- mtlb_legendre
- mtlb_linspace
- mtlb_logic
- mtlb_logical
- mtlb_lower
- mtlb_max
- mtlb_min
- mtlb_mode
- mtlb_more
- mtlb_num2str
- mtlb_ones
- mtlb_plot
- mtlb_prod
- mtlb_rand
- mtlb_randn
- mtlb_rcond
- mtlb_realmax
- mtlb_realmin
- mtlb_s
- mtlb_setstr
- mtlb_size
- mtlb_sort
- mtlb_strcmp
- mtlb_strcmpi
- mtlb_strfind
- mtlb_strrep
- mtlb_sum
- mtlb_t
- mtlb_toeplitz
- mtlb_tril
- mtlb_triu
- mtlb_true
- mtlb_uint16
- mtlb_uint32
- mtlb_uint8
- mtlb_upper
- mtlb_var
- mtlb_zeros

Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.

However, this page did not exist in the previous stable version.

# mtlb_var

Matlab var emulation function

### Arguments

- x
a real or a complex vector or matrix.

- s
a real scalar or real vector.

If x is a vector, s is the variance of x.

If x is a matrix, s is a row vector containing the variance of each column of x.

- w
type of normalization to use. Valid values are, depending on the number of columns m of x :

w = 0 : normalizes with m-1, provides the best unbiased estimator of the variance (this is the default).

w = 1: normalizes with m, this provides the second moment around the mean.

- dim
the dimension along which the variance is computed (default is 1, i.e. column by column). If dim is 2, the variance is computed row by row.

### Description

This function computes the variance of the values of a vector or matrix x. It provides the same service as Octave and Matlab. It differs from Scilab's variance primitive:

mtlb_var returns a real (i.e. with a zero imaginary part) variance, even if x is a complex vector or matrix. The Scilab variance primitive returns a complex value if the input vector x is complex and if no option additional is used.

Whatever the type of the input data x (i.e. vector or matrix), mtlb_var computes the variance either on dimension 1 or on dimension 2 while, if no option is passed to the Scilab's variance primitive, the variance is computed on all dimension at once.

### Examples

The following 3 examples illustrates the use of the mtlb_var function. In the first case, a column vector is passed to the function, which returns the value 750. In the second case, a matrix is passed to the function, which returns the row vector [0.16 0.09]. In the third case, a complex column vector is passed to the function, which returns a value close to 2.

### See also

- variance — variance (and mean) of a vector or matrix (or hypermatrix) of real or complex numbers

## Comments

Add a comment:Please login to comment this page.