# Changeset 247 for trunk/src/tps_eval_dxy.m

Ignore:
Timestamp:
Apr 29, 2011, 6:44:35 PM (10 years ago)
Message:

thin plate shell corrected for spatial derivatives

File:
1 edited

Unmodified
Added
Removed
• ## trunk/src/tps_eval_dxy.m

 r246 %            N centres, with s=space dimension, DMXY(:,:,k) gives the derivatives %            along dimension k (=x, y,z) after multiplication by the N+1+s tps sources. function DMXY = tps_eval_dxy(dsites,ctrs) function [DMX,DMY] = tps_eval_dxy(dsites,ctrs) %%  matrix declarations [M,s] = size(dsites); [N,s] = size(ctrs); Dsites=zeros(M,N,s); Dsites=zeros(M,N); DM = zeros(M,N); DMXY = zeros(M,N+1+s,s); % DMXY = zeros(M,N+1+s); %% Accumulate sum of squares of coordinate differences %  Ctrs, consisting of M identical rows (each containing %       the d-th coordinate of the N centers) for d=1:s [Dsites(:,:,d),Ctrs] = ndgrid(dsites(:,d),ctrs(:,d));%d coordinates of interpolation points (Dsites) and initial points (Ctrs) DM = DM + (Dsites(:,:,d)-Ctrs).^2;% add d component squared end %% calculate mtrix of tps derivatives DM(DM~=0) = log(DM)+1; %=2 log(r)+1 derivative of the tps r^2 log(r) for d=1:s DMXY(:,1:N,d)=Dsites(:,:,d).*DM; DMXY(:,N+1+d,d)=1;% effect of mean gradient end [Dsites,Ctrs] = ndgrid(dsites(:,1),ctrs(:,1));%d coordinates of interpolation points (Dsites) and initial points (Ctrs) DX=Dsites-Ctrs; [Dsites,Ctrs] = ndgrid(dsites(:,2),ctrs(:,2));%d coordinates of interpolation points (Dsites) and initial points (Ctrs) DY=Dsites-Ctrs; DM = DX.*DX + DY.*DY;% add d component squared %% calculate matrix of tps derivatives DM(DM~=0) = log(DM(DM~=0))+1; %=2 log(r)+1 derivative of the tps r^2 log(r) DMX=[DX.*DM zeros(M,1)  ones(M,1) zeros(M,1)];% effect of mean gradient DMY=[DY.*DM zeros(M,1)  ones(M,1) zeros(M,1)];% effect of mean gradient
Note: See TracChangeset for help on using the changeset viewer.