I have the following ODE -
$\frac{dn}{dt} = \frac{1-n}{A} - \frac{u(t)}{B}n , -30\leq t\leq30, n(-30)=1$
where $A,B$ are constants and $n = n(t)$.
I can solve this ODE analytically and get an expression for $n(t)$, but I'd like to do it numerically.
Assuming $u(t), n(t)$ and $t$ are vectors of the same length (with $t$ being a linearly spaced vector between -30 and 30), is there any way to find the solution of this ODE numerically?
I tried using ODE45, but it appears it cannot be used for some arbitrary vector $u$ and instead requires an expression for $u(t)$ in terms of $t$ which may not always be possible in my problem.
I do however know that $u(t)$ goes to zero well before the boundaries. Therefore, the choice of boundary conditions may not be an issue.