I am training $Z$-transforms but I have still problems with basic skills.
So the question is what is the Z-transform of $y_n$;
When $y_{n+1}=ay_n+hu_n$.
I would appreciate a detailed answer for the beginner.
edit: Yes it is for digital control. $y_n$ is the output on $u_n$ input.
In digital control, the $Z$-transform is defined by
$$Z\{ f(k)\}=f(z):=\sum_{k=0}^{\infty}f(k)z^{-k}.$$
We rewrite your equation as $y(k+1)-ay(k)-hu(k)=0$ and take the $Z$-transform:
So for your expression it is given by:
$$Z\{ y(k+1)-ay(k)-hu(k)\}=\sum_{k=0}^{\infty}[y(k+1)-ay(k)-hu(k)]z^{-k}$$ $$=\sum_{k=0}^{\infty}y(k+1)z^{-k}-ay(z)-hu(z)=\sum_{k=0}^{\infty}y(k+1)z^{-(k+1)}z^1-ay(z)-hu(z)$$ $$=z\left[\sum_{k=0}^{\infty}y(k+1)z^{-(k+1)}+y(0)z^{0}-y(0)z^0\right]-ay(z)-hu(z)$$ $$=z\left[\sum_{k=0}^{\infty}y(k)z^{-k}-y(0)\right]-ay(z)-hu(z)$$ $$=zy(z)-zy(0)-ay(z)-hu(z).$$
It is trivial to see that the $Z$-transform of the right-hand side $0$ is simply $0$. So we obtain:
$$(z-a)y(z)=zy(0)+hu(z).$$
If you assume zero initial conditions $y(0)=0$ then you get the $Z$-transfer function as:
$$F(z)=\frac{y(z)}{u(z)}=\frac{h}{z-a}.$$
Feel free to ask for more details if you need further explanations.