I'm not mistaken then 2DB means that the volume will be

3 time louder:

10log2 = 3

And therefor if you perform a loop on N then the value

in DB will be:

pow(10, (N/10))

However I don't think the volume is a function of the

distance raised to the power of 2 and in that case:

pow(10, (pow(N, 2)/10))

If it wont work, try to ask a forum which is more

oriented to Physics or Electrical-Engineering people.