arrays - How to calculate the size of a vector of this form? -
in matlab, it's easy define vector way:
x = a:b:c
, a
,b
,c
real numbers, a < c
, b <= c - a
.
my problem i'm having troubles trying define formula calculate number of elements in x
.
i know problem solved using size command, need formula because i'm doing version of matlab program (which uses vectors way), in language.
thanks in advance can provide.
best regards,
vĂctor
on mathematical level argue of these expressions return same:
size(a:b:c) size(a/b:c/b) size(0:c/b-a/b)
now end integers 0 term, is:
floor((c-a)/b+1)
there 1 problem: floating point precision. colon operator repeated summing, don't know possibility predict reproduce that.
Comments
Post a Comment