Re: Create linear spaced vector?

2004-12-17 Thread kjmacken
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


Re: Create linear spaced vector?

2004-12-17 Thread kjmacken
John,

Thanks for the heads up RE: scipy, I will keep my eyes on the
developments.

Also, thanks for the info:

[quote]
that the matplotlib.mlab package (where linspace and others functions
reside) do not require any extension code and can be reused anywhere
[/quote]

I was able to get these modules into my site-packages directory, and
make use of what is there.

Cheers,

kjm

-- 
http://mail.python.org/mailman/listinfo/python-list