function xtraj = ilqr_sim(x0, u, dt) % dlsim(A,B,C,D,u,x0)

    xtraj = zeros(length(u)+1, length(x0));

    xtraj(1,:) = x0;

    for i = 2:length(xtraj)
        xtraj(i,:) = ilqr_state_space(xtraj(i-1,:), u(i-1,:), dt);
    end
        
end
