3 %>@brief Splines transformation matrix
5 %> This matrix transforms a dataset into the coefficients
for reconstruction
using a spline basis. The transformation matrix is therefore the pseudo-inverse <code>B/(B
'*B)</code> of the spline basis.
7 %> <h3>References:</h3>
8 %> [1] Jim Ramsay, B. W. Silverman. Functional Data Analysis. 2nd Ed. Springer. 2005.
9 %> [2] J. Ramsay, G. Hooker, and S. Graves, Functional Data Analysis with R and MATLAB. New York: Springer, 2009.
10 %> Function @c create_bspline_basis
13 %> @param nf Number of features
14 %> @param no_basis Number of basis vectors
15 %> @param breaks =[] Break points. Check reference [1]
16 %> @param order =6 Spline order. Check reference [1]
17 %> @return The pseudo-inverse <code>B/(B'*B)</code> of the spline basis.
18 function L =
splinebasis(nf, no_basis, breaks, order)
20 if ~exist(
'order',
'var')
23 if ~exist('breaks', 'var') || isempty(breaks)
24 breaks = linspace(1, nf, no_basis-order+2);
27 bb = create_bspline_basis([1, nf], no_basis, order, round(breaks));
31 % We gotta get the loadings matrix
33 B = eval_basis(tt3, bb);
34 L = B/(B'*B); % L, the "loadings" matrix
function splinebasis(in nf, in no_basis, in breaks, in order)