In this paper,the quaternion matrix equations XF-AX=BY and XF-A=BY are investigated.For convenience,they were called generalized Sylvesterquaternion matrix equation and generalized Sylvester-j-conjugate quaternion matrix equation,which include the Sylvester matrix equation and Lyapunov matrix equation as special cases.By applying of Kronecker map and complex representation of a quaternion matrix,the sufficient conditions to compute the solution can be given and the expressions of the explicit solutions to the above two quaternion matrix equations XF-AX=BY and XF-A=BY are also obtained.By the established expressions,it is easy to compute the solution of the quaternion matrix equation in the above two forms.In addition,two practical algorithms for these two quaternion matrix equations are give.One is complex representation matrix method and the other is a direct algorithm by the given expression.Furthermore,two illustrative examples are proposed to show the efficiency of the given method.