Analytical solution of non-homogeneous anisotropic wave equations based on differential transfer matrices