function [Smoothed, Frq]=specsmooth(SS,DD)
jj=1;
Rdi=.185;  %Larger number in Rdi results in less points in the smoothed spectrum
Mj=1;
Di=0;
Slength=length(SS);
ii=0;
Dfx=DD/(Slength*2);
while ii<Slength;
   if ii==Slength;
      break;
   end;
   Di=round(Rdi*(Mj+Di));
   Smoothed(jj)=0;
   for ii=Mj:Mj+Di;
      if ii==Slength;
         break;
      end;
      Smoothed(jj)=Smoothed(jj)+SS(ii+1);
   end;
   Smoothed(jj)=Smoothed(jj)./(Di+1);
   Frq(jj)=(Mj+Di/2)*Dfx;
   Mj=Mj+Di+1;
   jj=jj+1;
end;
Smoothed=Smoothed(1:length(Frq)-1);
Frq=Frq(1:length(Frq)-1);
