Calculating an exponentially increasing vector of points in a test and measure system

66 Views Asked by At

My application is setting and measuring current and voltage in a physical system with a software algorithm. Given these parameters: min, max , and n, I need to calculate a set of n values from min to max (inclusive) with a dense distribution of values close to min, with decreasing distribution density (larger step size) approaching max.

A similar distribution could be obtained by f(i) = f(i-1) * k, with k > 1. However, this doesn't provide for control over number of values n, but one could start from min and stop before or near max, not guaranteeing the inclusion of max. This curve should appear linear when plotted in log scale.

I am looking for a function f(min, max, n, i) for some integral index i from 1 to n which would produce these values.

1

There are 1 best solutions below

0
On BEST ANSWER

You can use your idea $f(i)=f(i-1)*k$ just fine. If you want $n$ values, (hence $n-1$ factors of $k$) you need $k=\left(\frac {\max}{\min}\right)^{\frac 1{n-1}}$ Now $f(1)=\min, f(n)=\max, f(i)=\min\cdot k^{i-1}$