>>  Lectures >>  Matlab 9

 Navigator

## 9.1 Mean, Variance, and Standard Deviation

Simple measures of statistics include the mean (average), standard deviation, and variance. Each of these can be easily computed in Matlab:

Given a vector of values, for example gasoline prices on the East Coast: v=data(:,1); The mean is: mean(v) The variance is: var(v) The Standard Deviation is: std(v)
Given a matrix of random values, the mean, variance, and standard deviation are computed on a per column basis.

For example, for the matrix of all gasoline prices data:

mean, var, and std return vectors of values, one for each column:

 mean(data)std(data)var(data)

## 9.2 Min, Max

To select the minimum or maximum values from a vector, we use functions min and max . When used on vectors, min and max return scalars. When used on matrices, min and max return vectors with the minimum and maximum values determined from columns:

 min(data)max(data)
return the minimum and maximum values for prices in all regions.