Changeset 651 for trunk/src/tps_coeff_field.m
- Timestamp:
- Jun 25, 2013, 12:48:10 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tps_coeff_field.m
r586 r651 1 %'tps_coeff_field': calculate the thin plate spline (tps) coefficients with subdomains for a field structure1 %'tps_coeff_field': calculate the thin plate spline (tps) coefficients within subdomains for a field structure 2 2 %--------------------------------------------------------------------- 3 3 % DataOut=tps_coeff_field(DataIn,checkall) 4 4 % 5 5 % OUTPUT: 6 % DataOut: output field structure 6 % DataOut: output field structure, reproducing the input field structure DataIn and adding the fields: 7 % .Coord_tps 8 % .[VarName '_tps'] for each eligible input variable VarName (scalar ofr vector components) 9 % errormsg: error message, = '' by default 7 10 % 8 11 % INPUT: … … 72 75 end 73 76 ListNewVar=cell(1,numel(VarIndexInterp)+3); 74 ListNewVar(1:3)={['SubRange' term],['NbCentre s' term],['Coord_tps' term]};77 ListNewVar(1:3)={['SubRange' term],['NbCentre' term],['Coord_tps' term]}; 75 78 for ilist=1:numel(VarIndexInterp) 76 79 ListNewVar{ilist+3}=[ListVarInterp{ilist} '_tps' term]; … … 82 85 {{['nb_tps' term],'nb_coord',['nb_subdomain' term]}}]; 83 86 DataOut.VarAttribute{nbvar+3}.Role='coord_tps'; 84 [SubRange,NbCentre s,IndSelSubDomain] =set_subdomains([X Y],SubDomainNbPoint);% create subdomains for tps87 [SubRange,NbCentre,IndSelSubDomain] =set_subdomains([X Y],SubDomainNbPoint);% create subdomains for tps 85 88 for isub=1:size(SubRange,3) 86 ind_sel=IndSelSubDomain(1:NbCentres(isub),isub);% array indices selected for the subdomain 87 Coord_tps=[X(ind_sel) Y(ind_sel)]; 88 fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage) 89 Coord_tps=cat(1,Coord_tps,fill); 89 ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain 90 DataOut.(['Coord_tps' term])(1:NbCentre(isub),1:2,isub)=[X(ind_sel) Y(ind_sel)]; 91 DataOut.(['Coord_tps' term])(NbCentre(isub)+1:NbCentre(isub)+3,1:2,isub)=0;%matrix of zeros to complement the matrix Coord_tps (conveninent for file storage) 92 %fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage) 93 % fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage) 94 % Coord_tps=cat(1,Coord_tps,fill); 90 95 end 91 96 for ivar=1:numel(VarIndexInterp) … … 106 111 end 107 112 DataOut.(['SubRange' term])=SubRange; 108 DataOut.(['NbCentre s' term])=NbCentres;109 DataOut.(['Coord_tps' term])=Coord_tps;113 DataOut.(['NbCentre' term])=NbCentre; 114 % DataOut.(['Coord_tps' term])=Coord_tps; 110 115 for ilist=1:numel(VarIndexInterp) 116 % Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline 111 117 for isub=1:size(SubRange,3) 112 Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline113 [tild,Var_tps( :,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist}),0);%calculate the tps coeff in the subdomain118 ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain 119 [tild,Var_tps(1:NbCentre(isub)+NbCoord+1,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist})(ind_sel),0);%calculate the tps coeff in the subdomain 114 120 end 115 121 DataOut.(ListNewVar{ilist+3})=Var_tps;
Note: See TracChangeset
for help on using the changeset viewer.