[356] | 1 | %'tps_coeff': calculate the thin plate spline (tps) coefficients |
---|
| 2 | % (ref fasshauer@iit.edu MATH 590 ? Chapter 19 32) |
---|
| 3 | % this interpolation/smoothing minimises a linear combination of the squared curvature |
---|
| 4 | % and squared difference form the initial data. |
---|
| 5 | % This function calculates the weight coefficients U_tps of the N sites where |
---|
| 6 | % data are known. Interpolated data are then obtained as the matrix product |
---|
| 7 | % EM*U_tps where the matrix EM is obtained by the function tps_eval. |
---|
| 8 | % The spatial derivatives are obtained as EMDX*U_tps and EMDY*U_tps, where |
---|
| 9 | % EMDX and EMDY are obtained from the function tps_eval_dxy. |
---|
[581] | 10 | % for big data sets, a splitting in subdomains is needed, see functions |
---|
| 11 | % set_subdomains and tps_coeff_field. |
---|
| 12 | % |
---|
[246] | 13 | %------------------------------------------------------------------------ |
---|
[1139] | 14 | % [U_smooth,U_tps]=tps_coeff(ctrs,U,smoothing) |
---|
[246] | 15 | %------------------------------------------------------------------------ |
---|
[811] | 16 | % OUTPUT: |
---|
| 17 | % U_smooth: values of the quantity U at the N centres after smoothing |
---|
| 18 | % U_tps: tps weights of the centres and columns of the linear |
---|
[356] | 19 | |
---|
[811] | 20 | % INPUT: |
---|
| 21 | % ctrs: NxNbDim matrix representing the positions of the N centers, sources of the tps (NbDim=space dimension) |
---|
| 22 | % U: Nx1 column vector representing the values of the considered scalar measured at the centres ctrs |
---|
[1139] | 23 | % smoothing: smoothing parameter: the result is smoother for larger smoothing. |
---|
[581] | 24 | % |
---|
[811] | 25 | % RELATED FUNCTIONS: |
---|
| 26 | % tps_eval, tps_eval_dxy |
---|
| 27 | % tps_coeff_field, set_subdomains, filter_tps, calc_field |
---|
[356] | 28 | |
---|
[809] | 29 | %======================================================================= |
---|
[1126] | 30 | % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France |
---|
[809] | 31 | % http://www.legi.grenoble-inp.fr |
---|
[1127] | 32 | % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr |
---|
[809] | 33 | % |
---|
| 34 | % This file is part of the toolbox UVMAT. |
---|
| 35 | % |
---|
| 36 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 37 | % it under the terms of the GNU General Public License as published |
---|
| 38 | % by the Free Software Foundation; either version 2 of the license, |
---|
| 39 | % or (at your option) any later version. |
---|
| 40 | % |
---|
| 41 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 42 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 43 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 44 | % GNU General Public License (see LICENSE.txt) for more details. |
---|
| 45 | %======================================================================= |
---|
| 46 | |
---|
[1139] | 47 | function [U_smooth,U_tps]=tps_coeff(ctrs,U,smoothing) |
---|
[356] | 48 | %------------------------------------------------------------------------ |
---|
[586] | 49 | warning off |
---|
[581] | 50 | N=size(ctrs,1);% nbre of source centres |
---|
| 51 | NbDim=size(ctrs,2);% space dimension (2 or 3) |
---|
| 52 | U = [U; zeros(NbDim+1,1)]; |
---|
[246] | 53 | EM = tps_eval(ctrs,ctrs); |
---|
[1139] | 54 | SmoothingMat=smoothing*eye(N,N);% smoothing=1/(2*omega) , omega given by fasshauer; |
---|
[581] | 55 | SmoothingMat=[SmoothingMat zeros(N,NbDim+1)]; |
---|
[246] | 56 | PM=[ones(N,1) ctrs]; |
---|
[581] | 57 | IM=[EM+SmoothingMat; [PM' zeros(NbDim+1,NbDim+1)]]; |
---|
[356] | 58 | U_tps=(IM\U); |
---|
[809] | 59 | U_smooth=EM *U_tps; |
---|