Date  File  Comment by  Comment  Rating 

21 Feb 2015  Random Numbers from a Discrete Distribution Simple algorithm to generate random numbers from a userdefined discrete probability distribution.  ChiFu  
09 Jan 2015  Generate Random Numbers from a 2D Discrete Distribution Random numbers from any 2D discrete probability distribution, at any resolution.  Steven White  Very useful  thanks! 

17 Oct 2014  Generate Random Numbers from a 2D Discrete Distribution Random numbers from any 2D discrete probability distribution, at any resolution.  Tristan Ursell  Good catch  I just put a check in the code to make sure the interpolated values are always positive. 

17 Oct 2014  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  @Frank  That's an interesting idea, but I worry that it's too dependent on which point you choose as the first point. In other words, for the same vector, different starting points would give different results (although the same is true for the algorithm in general). Probably the right way to do something like that is calculate a distance matrix for all points and then do a bit of graph theory to group the points by mutual distance. Give it a try :) 

01 Oct 2014  Generate Random Numbers from a 2D Discrete Distribution Random numbers from any 2D discrete probability distribution, at any resolution.  M S  Excellent code, and amazingly, the only FEX submission for random sampling from 2D distributions. I did run into a little bug. When using interpolation (res>1), I occasionally get "Error: All elements of first argument, P, must be positive." thrown by gendist(). This looks like it comes from interpolation giving negative numbers. The only hint at the culprit is that the joint PDFs I'm sending to your function have very very small numbers, (e.g., 1.4822e323). When more reasonable numbers are used, the interpolation is fine. 

23 Aug 2014  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Frank Pennekamp  Hi,
maybe using an if statement when the starting point is closer than any other data point it closes the contour and starts a new one on the next point of your vector? I think this would be a very nice addition to your program for when your working with big spatial datasets. Cheers 

30 Jan 2014  Frechet Distance Calculator Estimate the similarity between curves in space using the scalar Frechet Distance.  Venkat R  Nice submission. Has great potential application. 

26 Oct 2013  Adaptive Colormap Function Creates a Colormap Specific to Data Easily design and fit a colormap to the values in your data!  Tristan Ursell  Hey Blake  found the single character bug that caused this! Be careful with the "<" vs. "<=" :) 

23 Oct 2013  Random Numbers from a Discrete Distribution Simple algorithm to generate random numbers from a userdefined discrete probability distribution.  Senthil  Thanks. It helped me in my program 

29 Sep 2013  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  Zheng  found a small bug that was responsible. New version uploaded, and awaiting approval from Mathworks (or just add "bad_pts=zeros(size(Xin));") at line 235. Thanks! 

29 Sep 2013  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  Hi Zheng, I presume this was with the last example? I'll take a look. 

28 Sep 2013  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Zheng  Hi, I like your idea but every time I run your examples with your points2contour function, errors occur. Please help asap! This is what showed up in the prompt window:
Error in points2contour (line 276)


22 Sep 2013  Find Image Extrema Find local maxima, local minima, saddle points, and flat regions in an image.  Zhouxin Xi  It works very well. I used it to find the image max peaks. more accurate than the extrema2.m 

19 Aug 2013  Adaptive Colormap Function Creates a Colormap Specific to Data Easily design and fit a colormap to the values in your data!  GradStudent  Works great, thanks for the submission! If anything: it would be nice if on a plot of 0100, there was only red and black showing on the plot  there's always blue and red showing on the plots, even if no negative values are present. 

15 Aug 2013  Image Noise Reduction by Local Statistics Reduce image noise by measuring local pixel statistics and remapping intensities.  Tristan Ursell  @ Krishna, what exactly do you mean by "unknown scaling"  the output image is the same size as the input image, so there's no scaling there, and the intensity values are not scaled, they are of course adjusted by the calculation itself. You can subtract the input from the output and verify that it removes (mostly) noise ... and hence there is no scaling. I designed this filter, but it is something like a cross between an averaging and median filter. If this clarified things for you, please consider rerating this to 5 stars. 

15 Aug 2013  Image Noise Reduction by Local Statistics Reduce image noise by measuring local pixel statistics and remapping intensities.  Krishna Kuchibhotla  It is awesome! Worked very well for the first time without IPT and not knowing much about the algorithm in use. 2 additional things would help much better...a) the axes are being scaled to unknown values; would be better to restore the scaling of Iout vector to Iin, b) any literature references to help understand the basics of the algorithm. Thanks. 

13 Aug 2013  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  @Roy, I included the requested feature late last month. 

05 Aug 2013  Frechet Distance Calculator Estimate the similarity between curves in space using the scalar Frechet Distance.  you  
23 Jul 2013  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  @Roy  good suggestion, I will try to implement that soon. 

23 Jul 2013  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Roy  This looks great, but I have a feature request: The builtin command 'sort' has the optional syntax [y,i]=sort(x) where y is a sorted version of x, and x(i)=y This is useful if you have several data vectors that all need to be reordered along with x. I think adding this feature to the program would be pretty simple, but that you could do it much faster than I could. Thanks! 

17 Jun 2013  Find Image Extrema Find local maxima, local minima, saddle points, and flat regions in an image.  Tobias  Very valuable file, thanks for uploading! 

17 Jun 2013  Create a Simulated Image of Diffraction Limited Spots with Noise Create images with diffractionlimited spots of varying size and intensity, with noise.  Abani Nayak  sir


17 Jun 2013  Create a Simulated Image of Diffraction Limited Spots with Noise Create images with diffractionlimited spots of varying size and intensity, with noise.  Abani Nayak  sir


10 Apr 2013  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Jay Cheng  Awesome work! It works on my data set while built in poly2cw does not. my x=[121
Maybe I misunderstood poly2cw. But what ever, your points2contour can sort my coordinates into correct order! Many thanks! 

14 Dec 2012  Adaptive Colormap Function Creates a Colormap Specific to Data Easily design and fit a colormap to the values in your data!  Tristan Ursell  I'll fix the typos in the description soon. 

15 Nov 2012  Image Noise Reduction by Local Statistics Reduce image noise by measuring local pixel statistics and remapping intensities.  Tristan Ursell  if you like this function, please consider rating it! (if you don't, please tell me why) 

26 Apr 2012  Generate Random Numbers from a 2D Discrete Distribution Random numbers from any 2D discrete probability distribution, at any resolution.  Filip TrÃ¶nnberg  Wonderful function!! 

23 Mar 2012  Copy Files in Batches using Search Terms Copy files matching search terms, from subdirectories matching search terms into a new directory.  Tristan Ursell  @Jan, thanks. I 'char'ed it just to be safe :) 

23 Mar 2012  Copy Files in Batches using Search Terms Copy files matching search terms, from subdirectories matching search terms into a new directory.  Jan Simon  Just a small comment:


15 Mar 2012  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  Here's a partial fix of the problem you mention Catherine. There is no general solution to your problem without solving the TSP  which is NP hard :) There is however another level of fix that would require time to write, where you sample Npoints ahead in the contour and search exhaustively for the shortest local Npath. That would likely get rid of most crossings and 

13 Mar 2012  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Catherine  Yes, that is interesting, in theory. In practice, this unexpected part of my project is a very annoying bottleneck. ;) Luckily, mine is a very rough shoreline (taken off a grid), and so is not really scaleindependent. 

13 Mar 2012  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  Hi Catherine  I'll be away for a few days, but yes, I was going to add a feature like that, and will try to get to it this week. Interesting that you bring up shorelines, which are fractals, and fractals, having no absolute scale do not have a definitely shortest contour. I realize that for your example its discrete and hence there is some shortest path, but it's still really hard to connect such structures because they tend to have this scale free property. 

13 Mar 2012  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Catherine  
13 Mar 2012  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Catherine  Tristan, do you have any hints for dealing with messy dat sets? I am tracing points along a shoreline, and your program gets it almost right, just a few places where it joins points across large distances that should not be connected. Something like 'if distance between points>X, redo' in some way or other. 

12 Mar 2012  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Tristan Ursell  @Catherine, glad to hear it's working well for you :) Please consider leaving a good rating so that others are more likely to try it. 

12 Mar 2012  Connect Randomly Ordered 2D Points into a Minimal NearestNeighbor Closed Contour Connects randomly ordered 2D points into a minimal nearest neighbor contour.  Catherine  This works great, and is very fast (on my admittedly small dataset). Thanks! I've been looking for something like this. 

02 Mar 2012  Random Numbers from a Discrete Distribution Simple algorithm to generate random numbers from a userdefined discrete probability distribution.  NNNN  Thanks a lot, Derek, this one is indeed a champion ! On a 2.1GHz machine, Matlab2008a 32bit,


09 Dec 2011  Random Numbers from a Discrete Distribution Simple algorithm to generate random numbers from a userdefined discrete probability distribution.  Derek O'Connor  Here is a function that beats those above by a mile: function S = DiscSampVec2(x,p,ns);
This is a slight modification of the function on page 47, Kroese, Taimre, and Botev, Handbook of Monte Carlo Methods, Wiley, 2011. >> ns=10^6; n=10^3; x=1:n;
>> t2=tic;
0.15835 

07 Dec 2011  Random Numbers from a Discrete Distribution Simple algorithm to generate random numbers from a userdefined discrete probability distribution.  Tristan Ursell  @Derek, I am aware and glad that there are other formulations of this task. 'N' and 'M' are clearly defined in the description above. There is no overt relationship between P and N & M. P is a distribution, in the mathematical sense of the word, and because it describes the probability of picking an index of P, the sum of those values must equal one, i.e. it must be normalized. For reference:
http://en.wikipedia.org/wiki/Normalizing_constant 

07 Dec 2011  Random Numbers from a Discrete Distribution Simple algorithm to generate random numbers from a userdefined discrete probability distribution.  Derek O'Connor  ALSO: See here
and here


07 Dec 2011  Random Numbers from a Discrete Distribution Simple algorithm to generate random numbers from a userdefined discrete probability distribution.  Derek O'Connor  It would be useful if the author would explain clearly what P, M, N are. For example, if P is a "discrete probability distribution for the indices of P", then why does it need to be normalized? Also I think the author means "density" or "mass function" rather than "distribution". Is M the size of the sample and is N the length of P? I presume the author is trying to do what this simple function does: function S = DiscITSamp1(x,p,ns); % Generate a random sample S of size ns
cdf = cumsum(p);
This is three times faster than GENDIST on a 2.3GHz machine, Matlab2008a 64bit >> ns=10^6;n = 10^3;x=1:n;p=rand(1,n);p=p/sum(p);
>> tic;S2 = gendist(p,1,ns);t=toc;disp([ns t])


06 Dec 2011  1D Nonderivative Peak Finder Upsample and filter noisy data to find peaks without using derivatives.  Tristan Ursell  No longer uses fspecial. Bug pointed out by Andrew has been fixed. 

06 Dec 2011  1D Nonderivative Peak Finder Upsample and filter noisy data to find peaks without using derivatives.  Tristan Ursell  HsuehHsin  I will look into that, agreed it would be preferable to not call it. 

16 Nov 2011  1D Nonderivative Peak Finder Upsample and filter noisy data to find peaks without using derivatives.  HsuehHsin  'fspecial' from Image Processing Toolbox: could it be removed/replaced 

15 Nov 2011  1D Nonderivative Peak Finder Upsample and filter noisy data to find peaks without using derivatives.  Tristan Ursell  Andrew  thank you  I will fix that! 

08 Nov 2011  1D Nonderivative Peak Finder Upsample and filter noisy data to find peaks without using derivatives.  Andrew Davis  Thanks for posting this, it works well, and the code is nicely laid out. One small bug, in order for the fourth method of calling the function to work, line 264 should be:


08 Nov 2011  1D Nonderivative Peak Finder Upsample and filter noisy data to find peaks without using derivatives.  Andrew Davis  
07 Sep 2011  1D Nonderivative Peak Finder Upsample and filter noisy data to find peaks without using derivatives.  Kiran  