Modeling exponential decay

65 Views Asked by At

I haven't take a math class in years and this shouldn't be as difficult as I think it is.

I am essentially simulating a moving bot within a grid that evaluates cells within a given radius based on the cells' distance to the bot, such that cells that are closer to the bot are more "attractive" to it. So, I would like to model "attraction" as a decreasing exponential function of "distance to the bot". On the y-axis is "attraction" which should be between 0 and 1, and the x-axis is "distance to the bot".

Additionally, there is another variable that is confusing as I don't know how to incorporate it. Bots can have a different radius (called "max length") within which they evaluate the attractiveness of each cell. So a cell that has a "distance to the bot" of say 10 meters will be less attractive (have a value closer to 0) to a bot with a max length of 15, than to a bot with a max length of 50. Below shows how I imagine the graph would look like:

Exponential decay of cell attractiveness with distance

Now for the actual model that I will use to calculate "attraction" for each cell. I know for exponential decay: y=a(1-r)^t, where a is the initial amount, r is the decay factor, and t is the rate of change. Would a for each cell be the cell's "distance to the bot"? I guess the actual decay factor doesn't matter too much for now. What would the "max length" be?

1

There are 1 best solutions below

2
On BEST ANSWER

Maybe I did not understand exactly what you need, so please let me know.

So you need something like in this picture, right?

enter image description here

Where you have maximum and minimum "attractiveness" $A_{\max}, A_{\min}$ you will assign and a maximum radious $r_{\max}$ as well.

The attraction field will have the form $A(r) = a \exp(-\lambda r)$ where $a,r>0$ are positive constants we will obtain in terms of $A_{\max}, A_{\min}, r_{\max}$ and $\exp(\bullet)$ is the exponential function.

We want:

  • $A(0) = A_{\max}$ which implies $a \exp(0) = a =A_{\max}$
  • $A(r_{\max}) = A_{\min}$ which implies $A_{\max}\exp(-\lambda r_{\max})=A_{\min}$ which means that $$ \exp(-\lambda r_{\max}) = \frac{A_{\min}}{A_{\max}}\implies -\lambda r_{\max} = \ln\left(\frac{A_{\min}}{A_{\max}}\right) \implies \lambda = -\frac{1}{r_{\max}}\ln\left(\frac{A_{\min}}{A_{\max}}\right) $$

Hence the attractive field reads: $$ A(r) = A_{\max}\exp\left(\frac{r}{r_{\max}}\ln\left(\frac{A_{\min}}{A_{\max}}\right)\right) $$

Is this what you wanted? Hope this helps!

As a tangential comment, you may want to take a look at the general formulation of "artificial potential fields" which does more or less the same as you want to do: assign attractiveness/repulsiveness to cells in a map according to goals/obstacles for a robot.