K
kjm
Hi Everyone,
I am trying to port some old MatLab code to python, and am stuck on
how to accomplish something.
I am trying to write a generalized function that will create a
linearly spaced vector, given the start and end point, and the number
of entries wanted.
In MatLab I have this function that I wrote:
I have the numeric package, numarray installed, and I think it should
be accomplished easily, but I just can't seem to get the syntax
correct with python.
Any tips would be greatly appreciated.
Thanks
I am trying to port some old MatLab code to python, and am stuck on
how to accomplish something.
I am trying to write a generalized function that will create a
linearly spaced vector, given the start and end point, and the number
of entries wanted.
In MatLab I have this function that I wrote:
Code:
function out = linearspace(x1,x2,n)
out = [x1+ (0:n-2)*(x2 - x1)/(floor(n)-1) x2];
return
I have the numeric package, numarray installed, and I think it should
be accomplished easily, but I just can't seem to get the syntax
correct with python.
Any tips would be greatly appreciated.
Thanks