function S = HarmonicSum( n ) S1 = 0; for i=1:n, S1 = S1 + 1/i; end; S2 = 0; for i=n:-1:1, S2 = S2 + 1/i; end; S = [ S1, S2 ];