function Dn=absval_squarewave(n) % This function forms the FS coefficients by taking the absolute value of % the FS coefficients for a squarewave signal. The squarewave has a period % of 3. It is equal to 1 from -1/2 to 1/2 and zero from 1/2 to 2.5 ind=find(n~=0); Dn(ind)=1/3*sin(pi/3*n(ind))./(pi/3*n(ind)); ind=find(n==0); Dn(ind)=1/3; Dn=abs(Dn); % take absolute value return