>>>>> "kjm" == kjm <[EMAIL PROTECTED]> writes:
kjm> Hi Everyone, I am trying to port some old MatLab code to
kjm> python, and am stuck on how to accomplish something.
kjm> I am trying to write a generalized function that will create
kjm> a linearly spaced vector, given the start and end point, and
kjm> the number of entries wanted.
kjm> In MatLab I have this function that I wrote:
kjm> [code]
kjm> function out = linearspace(x1,x2,n)
in matlab the builtin function to accomplish this is "linspace"
The python package matplotlib defines a host of matlab compatible
functions, including linspace
def linspace(xmin, xmax, N):
if N==1: return xmax
dx = (xmax-xmin)/(N-1)
return xmin + dx*arange(N)
Note that matplotlib extends the Numeric/numarray core of matlab
compatible functions (defined in MLab) to include plotting functions
http://matplotlib.sourceforge.net
A listing of matlab compatible functions is provided at
http://matplotlib.sourceforge.net/matplotlib.pylab.html
JDH
--
http://mail.python.org/mailman/listinfo/python-list