# Choosing values for octave/decade scale

I am developing a frequency response simulator for linear circuits which should be able to plot graphs of Voltage x Frequency with the latest varying linearly, in octaves or in decades. The only parameters I give the simulator are which kind of scale should be used, the number of points and the starting and ending frequencies.

The linear case is pretty straightforward. I simply subtract the lower frequency from the upper frequency and divide by the number of points so that I have the increment that should be added to the frequency at each iteration.

However, I cannot seem to find a way to do the same for the other two scales. How should I proceed in order to determine which frequency values should be used at each case?

Suppose your starting frequency is $x$, ending frequency is $y$, and you want to plot $z$ steps.

You got the first case right (although the term 'arithmetic' is better than linear). The frequencies $f$ are $f_k = x + rk$, with $r = \frac {y - x}{z}$ and $k = 0,1,...z-1$.

Octaves and decades are what are called a geometric sequence. You want to plot your values so that the logarithm of the frequencies occur at equal differences. So if 3 frequencies are plotted in a row, $f_0$ then $f_1$ then $f_2$, you want to require $\log f_1 - \log f_0 = \log f_2 - \log f_1$. Or to put it equivalently, you want $\frac{f_{k+1} }{f_{k}}$ to be a constant.

This is done by making $f_k = x \cdot r^k$ with $r = \sqrt[z]{\frac{y}{x}}$.

Derivation:

$$\frac {f_1} {f_0} = r$$ $$\frac {f_2} {f_0} = r^2$$ $$\frac {f_3} {f_0} = r^3$$ $$\vdots$$ $$\frac{f_{z-1}} {f_0} = r^z$$

Since the starting and ending frequencies are $x$ and $y$,

$$\frac{y} {x} = r^z$$ $$\sqrt[z]{\frac yx} = r$$

For octaves, $z = 8$ I'm guessing (this is different than how octave is used in occidental music where $z=12$). Decades suggest $z = 10$.