- #1
- 2,138
- 2,713
Basically, I wanted to create a Numpy array with linearly spaced integers between 0 and 3, the increment being 0.01.
Yes, I know Numpy offers a
I know that the numbers cannot be exact (can you explain why?). Matlab returns something similar when the
But then, in Matlab, I can write
Does Python have something similar?
Yes, I know Numpy offers a
linspace
function. I used it like this: x = np.linspace(0, 3, num=300)
(where np
is numpy), and got this:I know that the numbers cannot be exact (can you explain why?). Matlab returns something similar when the
linspace
function is used.But then, in Matlab, I can write
x = 0:0.01:3
, which will give me this:Does Python have something similar?