Home > vbmeg > functions > common > coordinate > vb_interpolate3_weight.m

vb_interpolate3_weight

PURPOSE ^

calculate weight matrix to interporate sensor data

SYNOPSIS ^

function W = vb_interpolate3_weight(pos_new,pos_base)

DESCRIPTION ^

 calculate weight matrix to interporate sensor data
  W = vb_interpolate3_weight(pos_new,pos_base)
  pos_new  : sensor position to interporate data  [Nnew  x 3]
  pos_base : sensor position of reference data    [Nbase x 3]
  W : sparse weight matrix for interpolation      [Nnew  x Nbase]
 
  data_new = W * data_base;
  data_base(n,t) : data corresponding to pos_base(n,:)             [Nnew  x T]
  data_new(m,t)  : interporated data corresponding to pos_new(m,:) [Nbase x T]

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    W = vb_interpolate3_weight(pos_new,pos_base)
0002 % calculate weight matrix to interporate sensor data
0003 %  W = vb_interpolate3_weight(pos_new,pos_base)
0004 %  pos_new  : sensor position to interporate data  [Nnew  x 3]
0005 %  pos_base : sensor position of reference data    [Nbase x 3]
0006 %  W : sparse weight matrix for interpolation      [Nnew  x Nbase]
0007 %
0008 %  data_new = W * data_base;
0009 %  data_base(n,t) : data corresponding to pos_base(n,:)             [Nnew  x T]
0010 %  data_new(m,t)  : interporated data corresponding to pos_new(m,:) [Nbase x T]
0011 %
0012 % Copyright (C) 2011, ATR All Rights Reserved.
0013 % License : New BSD License(see VBMEG_LICENSE.txt)
0014 
0015 Nbase = size(pos_base,1);
0016 Nnew  = size(pos_new,1);
0017 
0018 % find Np neighbor points for pos_new
0019 Np = 3;
0020 [indx, dd] = vb_distance_to_neigbor(pos_new,pos_base,Np);
0021 % indx(n,:) : Index of pos_base for neighbor position of pos_new(n,:)
0022 % dd(n,:)   : Distance from pos_new(n,:) to neighbor position in pos_base
0023 
0024 % Weight factor for linear interpolation using 3 neighbor points
0025 weight = vb_linear_interpolate3(dd);
0026 inext = repmat((1:Nnew)', [1 3]);
0027 
0028 W = sparse( inext(:) , indx(:) , weight(:) , Nnew, Nbase) ;
0029 
0030 %for n = 1:Nnew
0031 %    data_new(n,:) = weight(n,:) * data_base(indx(n,:), :);
0032 %end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005