function [c, g] = glob_indice_loc_cost(x,m,c,y_d,v)
x_m = x(1:get(m,'n_state'));
x_c = x(1+get(m,'n_state'):end);

u = zeros(1,get(m,'n_in') - length(v));
r_m = [x_m v u];
y = eval(m,r_m);

r_c = [x_c y_d y];
u = eval(c,r_c);

r_m = [x_m v u];	%Update the regressor with the new values

c = sum(eval_state(m,r_m).^2,2) + sum(eval_state(c,r_c).^2,2);
g = 0;
