Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: probability distribution function and isosurface
Date: Thu, 26 Aug 2010 03:47:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 31
Message-ID: <i54o3p$4m6$1@fred.mathworks.com>
References: <i544a1$rj9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1282794425 4806 172.30.248.37 (26 Aug 2010 03:47:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 26 Aug 2010 03:47:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:665076

"Mani Mani" <mousumimani@yahoo.co.in> wrote in message <i544a1$rj9$1@fred.mathworks.com>...
> I have an array containing [x, y, z] coordinates for different 200  molecules stored in a data file. 
> I want the  3D  probability density function of the coordinates and then I have to calculate ( visualize) the isosurface for different iso value.
> 
> I am not able to generate the 3D pdf.
> I tried this:
> 
> >>a=load('file.dat');
> >>y=pdf('Nornal', a);
> >>plot(y,a);
> 
> But I was not right.
> Can anyobdy help me with this ?
> 
> Thanks
> Mani
- - - - - - - - - - -
  Two hundred is not a lot of points to work with for three dimensions.  However, you could try doing something like this.  For any molecule at the point (x0,y0,z0) you could consider that it has been smeared into a three-dimensional Gaussian distribution with x0,y0,z0 as mean and some appropriate sigma, hopefully large enough for the Gaussians to overlap appreciably for the various molecules.  Real life molecules do after all have a definite extent in space.  By adding all the separate pdf's for the molecules and dividing by their total number you would have a kind of "smoothed" probability density.  The greater sigma is, the more smoothing occurs, but the less sensitivity you have to local variation.

  Let X, Y, and Z be vectors of the x, y, and z coordinates of the positions of all the molecules and let sigma be a value you have carefully selected.  Then prepare a function, either anonymous or a subfunction, that does this:

function p = moleculepdf(x,y,z)
p = 1/(length(X)*sigma^3*(2*pi)^(3/2)) * ...
    sum(exp(-((x-X).^2+(y-Y).^2+(z-Z).^2)/(2*sigma^2)));
return

This can constitute your probability density function, p(x,y,z).  It has the property that its total triple integral over all 3D space is one.  You may prefer to access the statistics toolbox to call on mvnpdf to make this computation simpler for yourself.

  Of course one drawback to this scheme is that such a density function in theory extends infinitely far in all directions.  However if sigma is not selected too large, the density should die off reasonably quickly outside the bounds of the molecular "object", whatever it is.  By the way, if I am not too inquisitive, what is this two-hundred molecule object?

Roger Stafford