Rank: 4402 based on 25 downloads (last 30 days) and 1 file submitted
photo

Marc Lalancette

E-mail
Company/University
Toronto Hospital for Sick Children

Personal Profile:

 

Watch this Author's files

 

Files Posted by Marc Lalancette
Updated   File Tags Downloads
(last 30 days)
Comments Rating
06 Feb 2014 Screenshot SurfaceSmooth Restricted smoothing of a triangulated surface Author: Marc Lalancette triangulation, surface, patch, smoothing 25 1
  • 5.0
5.0 | 1 rating
Comments and Ratings by Marc Lalancette View all
Updated File Comments Rating
17 Aug 2014 Kernel Density Estimator Reliable and extremely fast kernel density estimator for one-dimensional data Author: Zdravko Botev

Thanks, very useful. Strangely I get very different results on Matlab 2011b and 2013b with the same data. On the recent version, the density distribution is more smooth and has a stronger tendency to not go to 0 at the ends of the distribution. I'm guessing this is due to changes in a Matlab function. Any ideas?

03 Feb 2014 Volume of a surface triangulation Given a surface triangulation, compute the volume enclosed using divergence theorem. Author: Krishnan Suresh

Nice application, but here's a cleaned up version (with V = p' and F = f'):
% 'z' coordinate of triangle centers.
FaceCentroidZ = ( V(F(:, 1), 3) + V(F(:, 2), 3) + V(F(:, 3), 3) ) /3;
% Face normal vectors, with length equal to triangle area.
FNdA = cross( (V(F(:, 2), :) - V(F(:, 1), :)), ...
(V(F(:, 3), :) - V(F(:, 2), :)) , 2 ) / 2;
% Volume from divergence theorem (using vector field along z).
V = FaceCentroidZ' * FNdA(:, 3);

03 Jul 2012 Quartile & Percentile Calculation Demonstrates a method for computing percentiles and other basic statistics. Author: Chris D. Larson

Quick and practical, but doesn't properly take into account repeated median values, e.g. [1, 2, 2, 2, 2] would have the first 3 quartiles equal to 2, but this code would give [1, 2, NaN].

23 Mar 2012 COMBN (4.3) All combinations of N elements taken from the vector V. Author: Jos (10584)

Nice code, thanks! Just for fun, slight to medium speed improvement (sorry my k = your N):

%instead of:
%[Y{k:-1:1}] = ndgrid(X) ;
%Y = reshape(cat(k+1,Y{:}),[],k) ;
%fill Y directly:
nX = numel(X);
Y(nX^k, k) = X(1); % Initialize to give shape and data type.
s(1:k-1) = {ones(1, nX)};
for i = 1:k
Y( ((i-1)*nX^k + 1) : (i*nX^k) ) = X(s{1:i-1}, :, s{i:k-1});
X = permute(X, [1:i-1, i+1, i]);
end
% This has inverse order for the combinations as you had, easy to change.

22 Mar 2012 NCHOOSE (v2.1 mar 2010) return all combinations of the elements of a set Author: Jos (10584)

Theoretical note, in case someone (as I did) wants to get a limited number of random combinations, then this method fails for N > 51 since then eps(2^52) = 1, i.e. can't represent the integers accurately any more with double type. Of course, here we run out of memory with such a large N anyway.

Also, with bitget, I was using a loop over bits instead of a loop over combinations. I haven't checked, but I assumed it would be faster. I'm also going to check with d2b instead of bitget. (found on FEX, and modified to work on arrays).

Comments and Ratings on Marc Lalancette's Files
Updated File Comment by Comments Rating
16 Jun 2014 SurfaceSmooth Restricted smoothing of a triangulated surface Author: Marc Lalancette Thomas-Glyn Cox

Nevermind, I figured it out. So far looks great!

Contact us