function der = check_derivative(User,Cells,BS,Sim,t,Beta,l,k,c,b)

[obj, obj_wsr, obj_log1, obj_log2] = compute_obj(User,Cells,BS,Sim,t,Beta);

delta = 1e-10;

%test user

% User(l,k).current_rate = User(l,k).current_rate + delta;
% 
% [obj_new, obj_wsr_new, obj_log1_new, obj_log2_new] = compute_obj(User,Cells,BS,Sim,t,Beta);
% 
% der = (obj_new - obj)/delta;

%test BS
c=1;
b=1;
BS(c,b).current_compression_bkhaul = BS(c,b).current_compression_bkhaul + delta;
[obj_new, obj_wsr_new, obj_log1_new, obj_log2_new] = compute_obj(User,Cells,BS,Sim,t,Beta);

der = (obj_new - obj)/delta;