Reputation: 656
Having a background in Python I am familiar with the numpy library. In numpy there is a function called arange(start,end,step-size)
. It is a very useful function. Unlike linspace(start,end,total points)
, you can (without pre-calculating amount of total points) specify how small step you want.
I have tried to look for a similar function in Matlab (R2015a), but can only see two relevant choices : linspace
and colon
. Is there such a function in Matlab ?
Upvotes: 0
Views: 3563
Reputation: 56
The colon
function you mentioned in your question, using three arguments start:step-size:end
, seems to have the same ouput as arange(start,end,step-size)
.
In[1] numpy.arange(0,0.5,0.1)
Out[1] array([0., 0.1, 0.2, 0.3, 0.4])
And in Matlab
E = 0:0.1:0.4
E = 0 0.1000 0.2000 0.3000 0.4000
Edit :
As mentionned by Beaker, the end
is inclusive in Matlab, but exclusive in Python.
Upvotes: 3