In stochastic analysis, for an Ito diffusion $X_t$ such that $dX_t=\mu(X_t)dt+\sigma(X_t)dB_t$, we can exlpicitly compute a "natural scale function" $$S(x)=\int^x\exp\left(-\int^y\frac{2\mu(z)}{\sigma^2(z)}dz\right)dy$$ with suitable conditions on $\mu$ and $\sigma$, making $S(X_t)$ a martingale(or at least a local martingale).

**My question is: can we do something similar in more general processes, such as discrete time Markov processes?**

One example is the asymmetric simple random walk on $\mathbb{Z}$. Let $\xi_i$ be i.i.d. taking value $1$ with probability $p\not=\frac 12$, and value $(-1)$ with probability $q=1-p$. The random walk is then $X_n=\sum_{i=1}^n\xi_i$. Then we know the function $S(x)=(q/p)^x$ is a natural scale function since $S(X_n)$ is a martingale.

**Is there a systematic way to compute this function out, like in the Ito diffusion case?**

This question is also posted on MSE here.