I’m trying to simulate a stochastic state space model which looks something like:

```
x_dot(x) = A*x + B*u(x + n) + d
```

`A`

and `B`

are matrices, `x`

, `n`

, and `d`

are vectors and `u`

is an affine function.

Each of the elements of `n`

and `d`

are independent random variables.

How can I implement this as an SDEProblem for DifferentialEquations.jl?

I’ve figured out how to do this for `d`

but only for the special case where `d=v*W`

where `v`

is a vector and `W`

is a scalar random variable.

```
r = 1
kp = 0.5
kr = 0.5
A = [0 1
0 0]
B = [0,1]
u(x) = -kp*x[1] - kr*r
f(x,p,t) = A*x + B*u(x)
v = 0.3*[kp,1]
g(u,p,t) = v
prob = SDEProblem(f,g,[0,0], (0,10))
plot(solve(prob))
```

The documentation for SDE problem mentions that `g`

can be a vector such that the equation becomes:

But I’ve tried giving

`g`

as both a vector of vectors and a matrix and it always gives an error. What does `g`

need to look like to have multiple independent random variables?