IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
peak_db.m
Go to the documentation of this file.
1 %>@ingroup idata
2 %>@file
3 %>@brief Chemical-wavenumber correspondence
4 %>
5 %> Returns a table with substance names, peak centres and closest indexes in
6 %> @c x, if @c x is provided.
7 %
8 %> @param x (optional)
9 %> @param flag_table =0
10 function Z = peak_db(x, flag_table)
11 
12 
13 if ~exist('flag_table', 'var')
14  flag_table = 0;
15 end;
16 
17 Z.names = {'lipid',
18  'amide I',
19  'amide II',
20  'proteins?',
21  'proteins',
22  'COO- symmetric stretching vibrations of fatty acids and amino acid',
23  'amide III',
24  'asymmetric phosphate',
25  'carbohidrate',
26  'C-O stretch (nu CO)'
27  'symmetric phosphate',
28  'glycogen',
29  'protein phosphorylation'};
30 Z.centres = [
31  1750,
32  1635,
33  1531,
34  1454,
35  1425,
36  1396,
37  1260,
38  1225,
39  1155,
40  1140,
41  1080,
42  1030,
43  970];
44 
45 if exist('x')
46  no = length(Z.centres);
47  no_x = length(x);
48  Z.indexes = zeros(1, no);
49 
50  for i = 1:no
51  for j = 1:no_x
52  if Z.centres(i) > x(j)
53 
54  % Checks which point is closest, if current or last one.
55  if j == 1
56  Z.indexes(i) = j;
57  elseif Z.centres(i)-x(j) < x(j-1)-Z.centres(i)
58  Z.indexes(i) = j;
59  else
60  Z.indexes(i) = j-1;
61  end;
62  break;
63  end;
64  end;
65  if Z.indexes(i) == 0
66  Z.indexes(i) = no_x;
67  end;
68  end;
69 end;
70 
71 
function peak_db(in x, in flag_table)