% sumOfSinusoids2 - sum of sinusoids without a "for" loop

F0 = 50;
Nmax = 50;
fs = F0*2*Nmax*4;

tt = 0:1/fs:3/F0;

nn = (1:Nmax);
xx = 4./((2*nn-1)*pi) * cos(2*pi*(2*nn'-1)*F0*tt - pi/2);

plot(tt,xx);
xlabel( 'Time (s)')
grid