Geoscience Reference
In-Depth Information
Most of these functions have corresponding versions for data sets
containing gaps, such as nanmean and nanstd , which treat NaN s as missing
values. To illustrate the use of these functions we introduce a gap into our
data set and compute the mean using mean and nanmean for comparison.
corg(25,1) = NaN;
mean(corg)
ans =
NaN
nanmean(corg)
ans =
12.3371
In this example the function mean follows the rule that all operations with
NaN s result in NaN s, whereas the function nanmean simply skips the missing
value and computes the mean of the remaining data.
As a second example we now explore a data set characterized by a signii cant
skew. h e data represent 120 microprobe analyses on glass shards hand-
picked from a volcanic ash. h e volcanic glass has been af ected by chemical
weathering at an initial stage and the shards therefore exhibit glass hydration
and sodium depletion in some sectors. We can study the distribution of
sodium (in wt%) in the 120 analyses using the same procedure as above. h e
data are stored in the i le sodiumcontent_one.txt .
clear
sodium = load('sodiumcontent_one.txt');
As a i rst step, it is always recommended to display the data as a histogram.
h e square root of 120 suggests 11 classes, and we therefore display the data
by typing
h = histogram(sodium,11)
v = h.BinWidth * 0.5 + h.BinEdges(1:end-1)
n = h.Values
Since the distribution has a negative skew, the mean, the median and the
mode dif er signii cantly from each other.
mean(sodium)
ans =
5.6628
median(sodium)
Search WWH ::




Custom Search