# ode113

Solve a system of non-stiff differential equations.

## Syntax

[t,y] = ode113(@func,tin,y0)

[t,y] = ode113(@func,tin,y0,options)

[t,y,te,ye,ie] = ode113(...)

sol = ode113(...)

## Inputs

func
The system of equations to solve.
tin
The vector of times (or other domain variable) at which to report the solution. If the vector has two elements, the solver operates in single step mode and determines appropriate intermediate steps.
y0
The vector of initial conditions.
options
A struct containing options settings specified via odeset.
The default relative and absolute tolerances are 1.0e-3 and 1.0e-6.

## Outputs

t
The times at which the solution is computed.
y
The solution matrix, with the solution at each time stored by row.
te
The index of the event that recorded each zero value.
ye
The system function values corresponding to each te value.
ie
The event index corresponding to each zero value.
sol
A struct containing the solution data. The fields are as follows:
x
The times at which the solution is computed, stored as row vector.
y
The solution matrix, with the solution for each equation in the system stored by row.
solver
The solver name.
xe
The times at which the 'Events' function recorded a zero value.
ye
The system function values corresponding to each xe value.
ie
The index of the event that recorded each zero value.

## Example

Find the transient current in a series RLC circuit.

``````function dy = RLC(t,y,R,L,C)
% y = [i, di/dt]
dy = [0, 0];
dy(1) = y(2);
dy(2) = -y(1)/(L*C) - y(2)*(R/L);
end

v = 2.4; % volts
R = 1.1; % resistor
L = 1.6; % inductor
C = 0.8; % capacitor

handle = @(t,y) RLC(t,y,R,L,C);
t = [0:0.2:12]; % time vector
yi = [0, v/L];
[t,y] = ode113(handle,t,yi);
a = y(:,1)';
plot(t,a);
xlabel('time');
ylabel('amplitude');``````