mjgpy3 - 1 year ago 56

Python Question

Does Python have a function like matlab's

`linspace`

If not, is there an easy way to implement it without installing an external package?

Here's a quick and easy definition of linspace in matlab terms.

I don't need a "vector result" as defined by the link, a list will do fine.

Answer

No, it doesn't. You can write your own (whicn isn't difficult), but if you are using Python to fulfil some of matlab's functionality then you definitely want to install `numpy`

, which has `numpy.linspace`

.

You may find NumPy for Matlab users informative.