According to the perfect answer from A.Γ. in Any compact solution for $dX/dt = A X(t) + X(t) A^T$?, I understand that the solution of
$$\frac{dX(t)}{dt} = AX(t) + X(t)A^T,$$
where $A, X(t) \in {\mathbb R}^{n\times n}$ ($X(t) = X^T(t)$), is
$$X(t) = e^{At}X(0)e^{A^Tt}.$$
Now, consider the following ode
$$\frac{dX(t)}{dt} = AX(t) + X(t)A^T + Q,$$
where $Q$ is a symmetric matrix in ${\mathbb R}^{n\times n}$. I guess the solution is
$$X(t) = e^{At}X(0)e^{A^Tt} + \int_0^t e^{A(t-\tau)}Qe^{A^T(t-\tau)}d\tau.$$
The reason is when I take its derivative, I can get ${dX(t)}/{dt} = AX(t) + X(t)A^T + Q$. Am I right?
A rigorous way.
$$ X'=AX+XA^T+Q \quad\Longrightarrow\quad e^{-tA}(X'-AX)=e^{-tA}XA^T+e^{-tA}Q \quad\Longrightarrow\quad (e^{-tA}X)'=e^{-tA}XA^T+e^{-tA}Q \quad\Longrightarrow\quad \big((e^{-tA}X)'-e^{-tA}XA^T\big)e^{-tA^T}=e^{-tA}Q e^{-tA^T}\quad\Longrightarrow\quad \big(e^{-tA}Xe^{-tA^T}\big)'=e^{-tA}Q e^{-tA^T}\quad\Longrightarrow\quad e^{-tA}X(t)e^{-tA^T}=X(0)+\int_0^te^{-sA}Q e^{-sA^T}ds\quad\Longrightarrow\quad X(t)=e^{tA^T}X(0)e^{tA^T}+\int_0^te^{(t-s)A}Q e^{(t-s)A^T}ds. $$