On 23/11/2007, Rich Shepard <[EMAIL PROTECTED]> wrote:
>    Now I need to plot normal curves (a.k.a. Gaussian or bell curves,
> depending on the background of the speaker/writer). I see that SciPy has a
> class for the normal curve in its stats package, and that the curve shape is
> defined by the mean and standard deviation.

For parsimony, I think you're probably best off just using the
Gaussian equation:

def fwhm2k(fwhm):
    '''converts fwhm value to k (see above)'''
    return fwhm/(2 * n.sqrt( n.log( 2 ) ) )

def gauss1d(r, fwhm, c):
    '''returns the 1d gaussian given by fwhm (full-width at half-max),
    and c (centre) at positions given by r
    '''
    return exp( -(r-c)**2 / fwhm2k( fwhm )**2 )

(released to public domain)

>    My need is to draw these curves based on the midpoint (== mean) and tail
> endpoints (which are not the same as the s.d.).

The midpoint here is c.

It's not clear what you mean by endpoints - if you mean you want to be
able to specify the y value at a given x delta-x away from c, then it
should be relatively simple to solve the equation to find the required
full-width at half-max to achieve these end-points. After a very quick
look (i.e. definitely needs verification), I think

k = sqrt( -(R-c)**2/log(Y) )

where Y is the desired value at distance R-c from the centre.

>Your thoughts are appreciated.

I hope that's what you're after.

Angus,
-- 
AJC McMorland, PhD Student
Physiology, University of Auckland

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to