0001 function dataResample = resampleHeMatrix(heMatrix, nSample)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 centerRay = mean(heMatrix, 2);
0025 centerRay = centerRay ./ sum(centerRay);
0026 dataResample.centerRay = centerRay;
0027
0028 scaledDataVrep.V = bsxfun(@times, heMatrix, 1./(centerRay'*heMatrix))';
0029 dataResample.heMatrixScaled = scaledDataVrep.V';
0030
0031
0032 [dataDimReducedVrep rot x0] = reduceVrepDimension(scaledDataVrep);
0033
0034 [K V] = convhulln(dataDimReducedVrep.V);
0035 dataDimReducedVrep.V = dataDimReducedVrep.V(unique(K(:)), :);
0036
0037
0038 disD = obtainDistributionDiscrete('polytope', 'poly', dataDimReducedVrep, ...
0039 'nSample', nSample);
0040 heMatrixResampled = disD.positionMatrix';
0041
0042 removedCoordinates = zeros(size(heMatrixResampled, 1), 1);
0043 dataResampledVrep.V = [heMatrixResampled, removedCoordinates]*rot';
0044 dataResampledVrep = moveVrep(dataResampledVrep, x0);
0045 dataResample.heMatrixResampled = dataResampledVrep.V';
0046
0047