%%%%%%%%%% adesc_grad.m %%%%%%%%%% 
function [G] = adesc_grad(EE, iext, grd, WT, M_str, Lf, is_odd)
%  
%  Calculates gradients at the points iext 
%
G = [];
J = sqrt(-1);
fext = grd(iext);
W = 2*pi*fext*([0:(Lf-1)]+(~is_odd)*0.5);
Mb = eval(M_str);
Mb = -Mb';
MWT = diag(2.*(WT(iext).*EE(iext)));
M = Mb*MWT;
G = [real(M);imag(M)];
%%%%%%%%%% End adesc_grad.m %%%%%%%%%%
