001 function Hw = HwEstimate(Sf,SfBest,Hw,pos);
002
003
004
005
006
007
008
009
010
011 def = unique(pos(:,4)).';
012 k0 = find(def==5|def==7|def==11|def==14|def==17);
013 if any(k0), def(k0) = def(k0)-1;end
014 k0 = find(def==8);
015 if any(k0), def(k0) = def(k0)-2;end
016 def = unique(def);
017
018 k = find(SfBest~= 0);
019
020 for sensorType1 = def
021 if (sensorType1==6)
022 sensorType2 = 7; sensorType3 = 8;
023 ix1 = find(pos(:,4)==sensorType1); Nx1 = length(Nx1);
024 ix2 = find(pos(:,4)==sensorType2); Nx2 = length(Nx2);
025 ix3 = find(pos(:,4)==sensorType3); Nx3 = length(Nx3);
026 Nx = min([Nx1,Nx2,Nx3]);
027 if (Nx>0)
028 Hw0 = sqrt(mean(Sf(ix1(1:Nx),k)+Sf(ix2(1:Nx),k)+2*Sf(ix3(1:Nx),k),1)./SfBest(k));
029
030 Hw([ix1;ix2;ix3],k) = Hw0(ones(Nx1+Nx2+Nx3,1),k);
031 else
032 warning('Unable to estimate the surface curvature transferfunction!')
033 end
034 elseif any(sensorType1==[2:3 9 12 15 18])
035 ix1 = find(pos(:,4)==sensorType1);
036 Nx = length(ix1);
037 if Nx>0
038 Hw0 = sqrt(mean(Sf(ix1,k),1)./SfBest(k));
039
040 Hw(ix1,k) = Hw0(ones(Nx,1),:);
041 else
042 warning('Unable to estimate the transferfunction')
043 end
044 elseif any(sensorType1==[4 10 14 16])
045
046
047 sensorType2 = sensorType1+1;
048 ix1 = find(pos(:,4)==sensorType1); Nx1 = length(ix1);
049 ix2 = find(pos(:,4)==sensorType2); Nx2 = length(ix2);
050 Nx = min(Nx1,Nx2);
051 if (Nx>0)
052 Hw0 = sqrt(mean(Sf(ix1(1:Nx),k)+Sf(ix2(1:Nx),k),1)./SfBest(k));
053
054
055 Hw([ix1;ix2],k) = Hw0(ones(Nx1+Nx2,1),:);
056 else
057 warning('Unable to estimate the transferfunction')
058 end
059 end
060 end
061 return