Professional Documents
Culture Documents
Ac960435y Si 001
Ac960435y Si 001
1021/ac960435y
function democoda(data,window,level);
%function democoda(data,window,level);
%demonstrates the CODA algorithm (Anal. Chem .......
%The input argument data is a matrix with the spectra in rows. Window is the
%smoothing window used. Window should be odd. Level is the lower limit for the
%MCQ level based selection of mass chromatograms. The program plots the TIC of
%the original data set (Fig. la of paper), the TIC of the mass chromatograms
%selected by CODA (Fig. 2c of paper), and a plot of all the mass
%chromatograms.
%INITIALIZE
[nrows,ncols]-size(data);
halfwindow-(window-l)/2;
datasmoothed-zeros(nrows-window+l,ncols);
for i-1:window;
datasmoothed-datasmoothed+data(i:(nrows-window+i),:);
end;
data([1:halfwindow nrows-halfwindow+l:nrows],:)-[];
nrows-nrows-window+1;
lengthdata-sqrt(sum(data.*data));
datalengthscaled-data./lengthdata(ones(l,nrows),:);
%STANDARDIZE DATASMOOTHED
meandatasmoothed-mean(datasmoothed);
stddatasmoothed-std(datasmoothed);
datasmoothedstand-(datasmoothed-meandatasmoothed(ones(1,nrows),:))./...
stddatasmoothed(ones(1,nrows),:);
mcq-(l/sqrt(nrows-1))*sum(datalengthscaled.*datasmoothedstand);
close;subplot(311);plot(sum(data'),'w');title('TIC');
subplot(312);plot(sum(data(:,(mcq>level))'),'w');title('TIC CODA');
subplot(313);plot((data(:,(mcq>level))));title('MC''s CODA');