function Z=f(Y)
    E=12
    R=1
    L=30
    C=3
    Z=[Y(2);E/(L*C)-R*Y(2)/L-Y(1)/(L*C)]
endfunction    

function yy=RK2(f,tf,dt)
    Y=[0;0]
    yy=[Y]
    t=0
    while t < tf
        Y=Y+dt*f(Y+(dt/2)*f(Y))
        yy=[yy,Y]
        t=t+dt
    end
endfunction

