- #1

- 1,868

- 0

I am trying to solve a simple set of coupled ODE's by ODE45. The coupled system is given by:

Code:

```
function xprime = eoms(t, x)
xprime = [
1e9 + 5.0e4*x(3) - 50*x(1);
4.0e1*x(1) - 3.3e3*x(2);
2.0e3*x(2) - 5e4*x(3) + 3.5e7*heaviside(t-1)*x(4);
1.0e3*x(2) - heaviside(t-1)*5.0e7*x(4)];
```

I solve it using the following command:

Code:

```
x0 = [0 0 0 0];
tspan = [0, 2];
[t, x] = ode45(@eoms, tspan, x0);
```

Thanks in advance.

Best,

Niles.