flag_bad(3m)

NAME
flag_bad - Flag data as bad in a vector

SYNOPSIS
[v, mask] = flag_bad(v, sig_max )

DESCRIPTION
Calculate the mean value of the non-NaN in a vector, standard deviation and residuals for each element. An element is considered as bad if the absolute value of its residual is larger than a certain threshold value. The latter is determined as a factor times the standard deviation. This function can be used to detect vector elements that are much more different than the other ones.

PARAMETERS

v   Data vector.

sig_max
    Factor used to calculate the threshold value. A typical value is 2.5.

RETURNS

v   Vector with bad elements replaced by NaN.

mask
    Vector of ones or zeros,zeros specifying elements in v that have been flagged as bad,or that were already set to NaN on input.

AUTHORS
Pierre Jaccard, Geophysical Institute, University of Bergen, 1999