Mathematics Previous page   Next Page

Function Summary

A collection of functions provides basic column-oriented data analysis capabilities. These functions are located in the MATLAB datafun directory.

This section also gives you some hints about using row and column data, and provides some basic examples. This table lists the functions.

Basic Data Analysis Function Summary  
Function
Description
cumprod
Cumulative product of elements.
cumsum
Cumulative sum of elements.
cumtrapz
Cumulative trapezoidal numerical integration.
diff
Difference function and approximate derivative.
max
Largest component.
mean
Average or mean value.
median
Median value.
min
Smallest component.
prod
Product of elements.
sort
Sort array elements in ascending or descending order.
sortrows
Sort rows in ascending order.
std
Standard deviation.
sum
Sum of elements.
trapz
Trapezoidal numerical integration.

To use the Data Statistics Tool to calculate the maximum, minimum, mean, median, range, and standard deviation on plotted data, and create plots of these statistics, see "Using the Data Statistics Tool" in the MATLAB graphics documentation.

Working with Row and Column Data

For vector input arguments to these functions, it does not matter whether the vectors are oriented in row or column direction. For array arguments, however, the functions operate column by column on the data in the array. This means, for example, that if you apply max to an array, the result is a row vector containing the maximum values over each column.

Basic Examples

Continuing with the vehicle traffic count example, the statements

result in

To locate the index at which the minimum or maximum occurs, a second output parameter can be specified. For example,

shows that the lowest vehicle count is recorded at 02h00 for the first observation point (column one) and at 23h00 and 24h00 for the other observation points.

You can subtract the mean from each column of the data using an outer product involving a vector of n ones.

Rearranging the data may help you evaluate a vector function over an entire data set. For example, to find the smallest value in the entire data set, use

which produces

The syntax count(:) rearranges the 24-by-3 matrix into a 72-by-1 column vector.


Previous page  Basic Data Analysis Functions Covariance and Correlation Coefficients Next page

© 1994-2005 The MathWorks, Inc.