resampleHeMatrix

PURPOSE ^

resample hC-Matrix to obtain evenly distributed points

SYNOPSIS ^

function dataResample = resampleHeMatrix(heMatrix, nSample)

DESCRIPTION ^

 resample hC-Matrix to obtain evenly distributed points

 THIS IS NO USER FUNCTION

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dataResample = resampleHeMatrix(heMatrix, nSample)
0002 % resample hC-Matrix to obtain evenly distributed points
0003 %
0004 % THIS IS NO USER FUNCTION
0005 
0006 % The elk-library: convex geometry applied to crystallization modeling.
0007 %   Copyright (C) 2013 Alexander Reinhold
0008 %
0009 % This program is free software: you can redistribute it and/or modify it
0010 %   under the terms of the GNU General Public License as published by the
0011 %   Free Software Foundation, either version 3 of the License, or (at your
0012 %   option) any later version.
0013 %
0014 % This program is distributed in the hope that it will be useful, but
0015 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0016 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017 %   General Public License for more details.
0018 %
0019 % You should have received a copy of the GNU General Public License along
0020 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 
0022 
0023 %% scale data
0024 centerRay = mean(heMatrix, 2);
0025 centerRay = centerRay ./ sum(centerRay);
0026 dataResample.centerRay = centerRay;
0027 % we create a vrep
0028 scaledDataVrep.V = bsxfun(@times, heMatrix, 1./(centerRay'*heMatrix))';
0029 dataResample.heMatrixScaled = scaledDataVrep.V';
0030 
0031 %% reduce to convex hull
0032 [dataDimReducedVrep rot x0] = reduceVrepDimension(scaledDataVrep);
0033 % convex hull points
0034 [K V] = convhulln(dataDimReducedVrep.V);
0035 dataDimReducedVrep.V = dataDimReducedVrep.V(unique(K(:)), :);
0036 
0037 %% resampling
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

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005