Thanks for the code snippets guys. Exactly what I needed to get going.
I knew I could get the solution from matplotlib, but getting it
installed using Fink (OS X) has been giving me a headache, so I thought
I could just write my own function for now to get a small piece of code
written
The help is greatly appreciated.
kjm
John Hunter wrote:
> > "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