IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
diff_operator.m
Go to the documentation of this file.
1 %>@ingroup maths
2 %> @file
3 %> @brief Creates differentiation matrix.
4 %>
5 %> Creates a <code>[nf-order]x[nf]</code> differential operator matrix @c D so that <code> D*x = diff(x, order)
6 %> </code>
7 %
8 %> @param nf
9 %> @paran order
10 %> @return D
11 function D = diff_operator(nf, order)
12 
13 if order == 0
14  D = eye(nf, nf);
15 else
16  D = diff_operator(nf-1, order-1)*diff_operator1(nf);
17 end;
18 
19 %>@cond
20 % creates a differential operator of order 1
21 function D = diff_operator1(nf)
22 D = zeros(nf-1, nf);
23 for i = 1:nf-1
24  D(i, i) = -1;
25  D(i, i+1) = 1;
26 end;
27 
28 %>@endcond
function diff_operator(in nf, in order)