% x1 = v, x2 = u, x3 = xi, x4 = eta, x5 = lambda
fsystem = @(x) [
(v(i) + h/2*(fv(lambda(i), eta(i)) + fv(x(5), x(4)))) - x(1);
(u(i) + h/2*(fu(lambda(i), xi(i)) + fu(x(5), x(3)))) - x(2);
(eta(i) + h/2*(v(i) + x(1))) - x(4);
(xi(i) + h/2*(u(i) + x(2))) - x(3);
(lambda(i) + h/2*(fl(v(i)) + fl(x(1)))) - x(5);
(x(3)^2 + x(4)^2) - l^2;
x(3)*x(2) + x(4)*x(1)
];
x = [v(i), u(i), xi(i), eta(i), lambda(i)];
options = optimset('Display','off', 'Algorithm', 'levenberg-marquardt');
x = fsolve(fsystem, x, options);
v(i+1) = x(1);
u(i+1) = x(2);
xi(i+1) = x(3);
eta(i+1) = x(4);
lambda(i+1) = x(5);