Home > chronux > fly_track > FAnalyze > functions > ProbDist1D.m

# ProbDist1D

PROBDIST1D

## SYNOPSIS function [P bins] = ProbDist1D(x, nbins);

## DESCRIPTION ```PROBDIST1D
Usage: [P bins] = ProbDist1D(x, nbins);

This function calculates the discrete probability distribution for a
variable that is in a one dimensional phase space.  It is simply a
normalized histogram using 'hist', so nbins can take any form that hist
can take, although it does not allow for all the other hist options.```

## CROSS-REFERENCE INFORMATION This function calls:
This function is called by:

## SOURCE CODE ```0001 function [P bins] = ProbDist1D(x, nbins);
0002
0003 %PROBDIST1D
0004 %   Usage: [P bins] = ProbDist1D(x, nbins);
0005 %
0006 % This function calculates the discrete probability distribution for a
0007 % variable that is in a one dimensional phase space.  It is simply a
0008 % normalized histogram using 'hist', so nbins can take any form that hist
0009 % can take, although it does not allow for all the other hist options.
0010
0011 %Written by Dan Valente
0012 %September 2007
0013
0014 [H bins] = hist(x, nbins);
0015 N = sum(sum(H));
0016 binsize = bins(3)-bins(2);
0017 P = H./(N*binsize);  %divide by total points and binsize to normalize correctly
0018
0019 return;```

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005