Here is some matlab code for thresholding of continuos histograms. Use the matlab help command for parameter information. I do hope that the code is both readable and useful. All files reside in the /usr/users2/joakim/matlab/public/chist2 directory. Have fun and tell me how it worked. /Joakim Usage examples: For testing of many sigmas on a data-file. >> chistplot('myfile.dat',1:4); For testing many data-files, one sigma (here set to 2). >> chistplotfiles('*.dat',2); Automagic thresholding of an image using rule of thumb value for sigma Note: It is rather slow, so don't try too large images. >> mthresh(data); Note: Suggested threshold is the largest peak in the second derivative, which is not always the threshold we are interested in. Tip: If you don't want to copy, just add the directory to your matlab path. If you want it permanently, put it in startup.m in your ~/matlab directory (which in your matlab path by deafault if you create it). File listing: High level functions: autothresh.m automagic thresholding of an image chistplot.m plots and thresholds a single data-file, many sigmas allowed chistplotfiles.m plots and thresholds many files Mid level functions: chistplotone.m plots and thresholds a continuos histogram chplot.m plots a continus histogram d2chplot.m plots a second derivative chist hplot.m plots a histogram h_rot.m rule of thumb value for sigma Low level funcitons: chist.m continuos version of the hist command d2chist.m second derivative of chist x_interval.m linear interval that surrounds the data Low level, pure math: gauss.m gaussian function dgauss.m derivative of a gaussian (not used) d2gauss.m second derivative of a gaussian Help functions: dirren.m directory help function linewidth.m set linewith relaxx.m show a little bit more of the plot relaxy.m scale_height.m scale the height of the current plot Last edit: 2000-07-28