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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -