Purityengine
Contents |
Purpose
Calculates purity values of columns of data set.
Synopsis
- [purity_index,purity_values,length_values]=purityengine(data,base,offset)
Description
PURITYENGINE calculates the column index of the variable in data that has the largest angle with respect to base. For the first pure variable base should be empty: the program then substitutes a vector of ones for base. base generally contains previously determined pure variables. The argument offset gives a lower weight to variables with low values. Its value is based on a percentage of the maximum value of the mean of data. A typical value is 3.
The output arguments purity_values contains the purity values for all the variables and can be plotted as the "purity spectrum". The argument length_values contains the purity_values multiplied by the length of the variables. This results in a "length spectrum" that is easier to relate to the original data than the purity spectrum
Inputs
- data : Matrix to be analyzed.
- base : Matrix with previously selected pure variable intensities, for first pure variable it should be empty. When base is a single integer, e.g. 3, the first 3 pure variables are calculated.
- offset : Noise correction factor.
- h : Handle for waitbar, optional.
Outputs
- purity_index : Index(indices) of maximum value in purity_values, i.e. the index of the pure variable .
- purity_values : array (or matrix) with purity values with length of the column dimension of data, the purity spectrum.
- length_values : Array (or matrix) with purity values multiplied by length of columns of the data set, whci results in a spectra than is easier to relate to the original data. The length is the column dimension of data.
Examples
Determination of three pure variables of a matrix data for an offset of 3
[purity_index,purity_values,length_values]=purityengine(data,[],3); purity_array=[purity_index]; [purity_index,purity_values,length_values]=purityengine(data,... data(:,purity_array),3); purity_array=[ purity_array purity_index]; [purity_index,purity_values,length_values]=purityengine(data,... data(:,purity_array),3); purity_array=[ purity_array purity_index];
The indices of the three pure variables are in purity_array. A plot of purity_values and length_values shows the successive stages of the pure variable extraction.
Algorithm
The calculations are based on the MATLAB function subspace. The angle of every variable in the data is calculated with respect to the base: subspace(base,data(:,i))