% SYSTEM OF EQUATIONS SCALAR FIELD + ELECTRIC FIELD

function S = scalars_2(t,y,mq,d,Kmin,Kmax,N,E0,w0)

 %uncomment the classical source you want to consider
 
 %j0 =-E0./(1+t).^(2);
 j0=0;
 %j0=2*E0*w0*(sech(w0*t).^2).*tanh(w0*t);

S = zeros(N,1);

for n=0:4:N-3

 K=(n*d)/4 + Kmin; 
 W=(K^2 + mq^2).^(1/2);

S(n+1) = - ((K - y(N-1)).^2 + mq^2).*y(n+3); % Re(dh)
S(n+2) = - ((K - y(N-1)).^2 + mq^2).*y(n+4); % Im(dh)
S(n+3) = y(n+1); % Re(h)
S(n+4) = y(n+2); % Im(h)

S(N) = S(N) + d./(2*pi).*((K - y(N-1)).*((y(n+3)).^2 + (y(n+4)).^2) - K/(W));%Pepe

end

 S(N) = S(N)+j0 + y(N-1)/(pi);
 S(N-1) = y(N);
 
end