Message Boards Message Boards


[✓] Use a Wolfram Language equivalent to Matlab "linspace" function?

Posted 2 months ago
3 Replies
4 Total Likes


Matlab has a built in function called linspace, that, according to the documentation, generates a linearly spaced vector, but "gives direct control over the number of points and always includes the endpoints".

Mathematica doesn't work with vectors, rather with lists, but I wish to generate a list of numbers that start from x1 and ends at x2, with n points in between (such that the spacing between the points is (x2-x1)/(n-1).

I couldn't find help with Table. Table generates a list of numbers with a starting point and an end point, with an extra option for the intervals, but I want to have n numbers in between.

Is there any work around?

3 Replies


Posted 2 months ago
Posted 2 months ago

Thanks very much!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract