File Exchange

image thumbnail


version 1.0 (3.5 KB) by

Plots a histogram with a gaussian fit to the data.

3 Ratings



No License

M-Files which plot a histogram with a gaussian fit to the data and write the information to the screen as well as on the command line.

The general usage is hfitg(array,num_of_bins) you can also use hfitg(array,num_of_bins,min_value,max_value) Where min_value and max_value will be the min/max limits of the histogram.

The function also calculates the chi^2 of the fit and reports this as well as the number of degrees of freedom.

These routines are based on similar routines in PAW that I found I couldn't live without. Hope they are of use to others.

Comments and Ratings (3)


Seth (view profile)

chisq_min.m needs updated to remove the use of deprecated methods as the 9 Dec 2006 post suggest.

Current file contents
options(14)= 500*prod(size(x));

Replace with
options.MaxIter = 500 * prod(size(x));
parout = fminsearch( 'gx', par, options );

There are other fields that could be filled in that are used by fminsearch (see link below), but this was sufficient to get working. The code seems to be doing exactly what I needed at this time.

Colin O'Flynn

Works great - in the chisq_min.m file you need to replace the reference to fmins() wiht fminsearch() for it to work with later Matlab releases.

Will Yuen

Gaussiran.. is that your real last name..?

excellent code btw, very useful

MATLAB Release
MATLAB 5.2 (R10)

Inspired: Optometrika

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today