I posted it on the forum, just in case I didn't found the answer myself. I knew it had something to do with setting something on zero. :)

So I tried something, I tried this:

K = 8;
L = 950*10^-9;
g = 2*pi/L;
v0 = 30;
v = -90:10:90;
d = 950*10^-9;
Ssum = 0;
for i = 1:8;
Ssum = S + Ssum;
S = exp(1i*g*(K-i)*d*(sind(v)-sind(v0)));
end
A = 20*log(abs(Ssum)/8);
A

Is this equivalent to yours? Thanks for your help and quick reply, btw.