Differential equation with gaussian noise The equation has the following form:
$$x'' + w^2 x=n$$
$w=1$, $x(0)=1$, $n$ is Gaussian noise with mean $0$ and standard deviation of $1$.
Without the Gaussian noise, i can easily solve the equation numerically by using ODE45 in matlab.The problem is, how can i deal with this equation when the Gaussian noise is taken into consideration?
 A: Let $X_t$ denote the position of this stochastic oscillator, and $V_t$ denote its velocity. A meaningful interpretation of the quoted differential equation is
$$
    X_t = x_0 + \int_0^t V_s \mathrm{d} s, \quad V_t = v_0 - \omega^2 \int_0^t X_s \mathrm{d} s + \sigma W_t
$$
where $W_t$ denotes the standard Wiener process. The deterministic case corresponds to $\sigma = 0$. 
In the differential form this SDE reads:
$$
  \mathrm{d} \begin{pmatrix} X_t \\ V_t \end{pmatrix} = \hat{B}.\begin{pmatrix} X_t \\ V_t \end{pmatrix} \mathrm{d} t + \begin{pmatrix} 0 \cr \sigma \end{pmatrix} \mathrm{d} W_t
$$
where $\hat{B} = \begin{pmatrix} 0 & 1 \\ -\omega^2 & 0 \end{pmatrix}$.
This is an exactly solvable system, with $(X_t, V_t)$ being a Guassian process. It is solved using Ito lemma:
$$
   \mathrm{d} \left( \mathrm{e}^{-\hat{B} t}\cdot \begin{pmatrix} X_t \\ V_t \end{pmatrix} \right) = \mathrm{e}^{-\hat{B} t}\cdot  \begin{pmatrix} 0 \cr \sigma \end{pmatrix} \mathrm{d} W_t
$$
Which implies
$$
    \begin{pmatrix} X_t \\ V_t \end{pmatrix} = \mathrm{e}^{\hat{B} t} \cdot \begin{pmatrix} x_0 \\ v_0 \end{pmatrix} + \mathrm{e}^{\hat{B} t} \cdot \int_0^t  \mathrm{e}^{-\hat{B} s} \begin{pmatrix} 0 \cr \sigma \end{pmatrix} \mathrm{d} W_s 
$$
Using
$$
  \mathrm{e}^{-\hat{B} t} = \begin{pmatrix} \cos(\omega t) & - \frac{\sin(\omega t)}{\omega} \cr \omega \sin(\omega t) & \cos(\omega t) \end{pmatrix}
$$
we arrive at the solution:
$$ \begin{eqnarray}
  X_t &=& x_0 \cos(\omega t) + \frac{v_0}{\omega} \sin(\omega t) + \frac{\sigma}{\omega} \int_0^t \sin((t-s) \omega) \mathrm{d} W_s \\
  V_t &=& v_0 \cos(\omega t) - x_0 \omega \sin(\omega t) + \sigma \int_0^t \cos((t-s) \omega) \mathrm{d} W_s
\end{eqnarray}
$$
Since $(X_t, V_t)$ is Gaussian, value of the process at any $t$ is a multinormal random vector with mean and covariance matrix found by using Ito isometry:
$$ \begin{eqnarray}
   \mathbb{E}(X_t) &=& x_0 \cos(\omega t) + \frac{v_0}{\omega} \sin(\omega t) \\
   \mathbb{E}(V_t) &=& v_0 \cos(\omega t) - x_0 \omega \sin(\omega t) \\
   \mathbb{Var}(X_t) &=& \frac{\sigma^2}{\omega^2} \int_0^t \sin^2(\omega (t-s)) \mathrm{d} s = \frac{\sigma^2}{\omega^2} \left( \frac{t}{2} - \frac{\sin(2 \omega t)}{4 \omega} \right) \\
   \mathbb{Var}(V_t) &=& \sigma^2 \int_0^t \cos^2(\omega (t-s)) \mathrm{d} s = \sigma^2 \left( \frac{t}{2} + \frac{\sin(2 \omega t)}{4 \omega} \right) \\
   \mathbb{Cov}(X_t,V_t) &=& \frac{\sigma^2}{\omega} \int_0^t \sin(\omega (t-s)) \cos(\omega (t-s)) \mathrm{d}s = \sigma^2 \frac{ \sin^2(\omega t)}{2 \omega^2}
\end{eqnarray}
$$
A: In the case you need to simulate this equation, there are many numerical methods for SDE (stochastic differential equations). The best source to simply start simulations is, in my taste, this book with R examples. (in the simplest example, you can apply the Euler's scheme to turn the system into discrete dynamical system, and then simulate trajectories of this system by using any random number generator).
However, your equation allows complete analytic treatment, although, as far as I can recall, the solution properties are not nice due to the lack of the damping term in the oscillator. 
