My first initial thought was to use linspace with for loop. and then results is a matrix where when the i increase it will concatenate into the results matrix... I'm not sure on the ??? part. The easier the code the better as I am transferring the matlab code to VB later as well...