function[acceleration]=sine_to_psd_spec_ARBIT(npoints,freq,t,syn,dt,damp)
%
clear omega;
clear fn;
clear n;
clear a_resp;
clear x_neg;
clear x_pos;
%
n=npoints;
fn=freq;
%
    omega=2.*pi*fn;
    omegad=omega*sqrt(1.-(damp^2));
%
    out5 = sprintf(' omega=%g   omegad=%g ',omega,omegad);
%%%    disp(out5);    
%    
    cosd=cos(omegad*dt);
    sind=sin(omegad*dt);
%
    out5 = sprintf(' cosd=%g   sind=%g ',cosd,sind);
%%%    disp(out5);    
%
    domegadt=damp*omega*dt;
    a1(1)=2.*exp(-domegadt)*cosd;
    a2(1)=-exp(-2.*domegadt);
%
    out5 = sprintf(' a1=%g  a2=%g ',a1(1),a2(1));
%%%    disp(out5);  
%
    b1(1)=2.*domegadt;
    b2(1)=omega*dt*exp(-domegadt);    
    b2(1)=b2(1)*( (omega/omegad)*(1.-2.*(damp^2))*sind -2.*damp*cosd );
 %
    out5 = sprintf(' b1=%g   b2=%g ',b1(1),b2(1));
%%%    disp(out5);  
%
    c2(1)=-(dt/omegad)*exp(-domegadt)*sind;
 %
%%    out5 = sprintf(' c2=%g  ',c2(1));
%%    disp(out5);  
%
clear yy;
%
yy=zeros(1,n);
for i=1:length(syn)
        yy(i)=syn(i);        
end        
%
%  SRS engine
%
%%% disp(' ')
%%% disp(' Calculating acceleration');
for j=1:1
%
    forward=[ b1(j),  b2(j),      0 ];
    back   =[     1, -a1(j), -a2(j) ];
%    
    a_resp=filter(forward,back,yy);
%
    x_pos(j)= max(a_resp);
    x_neg(j)= min(a_resp);
end
%
disp(' ')
disp(' ')
disp(' Acceleration Response ')
mu=mean(a_resp);
sd=std(a_resp);
arms=sqrt(sd^2+mu^2);
peak=max(abs(a_resp));
if(abs(x_neg(1))>peak)
    peak=abs(x_neg(1));
end
%
clear aar;
aar=a_resp-mu;
aar=aar.^4;
kurtosis=sum(aar)/(n*sd^4);
%
 out9=sprintf('\n absolute peak = %10.2f G \n',peak);
%%%% disp(out9);
%
out10=sprintf('\n      maximum = %10.2f G',x_pos(1));
  out11=sprintf('      minimum = %10.2f G',x_neg(1));
  out12=sprintf('      overall = %10.2f GRMS',arms);
out13=sprintf('\n         mean = %10.2f G',mu);
  out14=sprintf('      std dev = %10.2f GRMS',sd);
  out15=sprintf(' crest factor = %10.2f',peak/sd);
  out16=sprintf('     kurtosis = %10.2f',kurtosis);  
%
%%%% disp(out10)
%%%% disp(out11)
%%%% disp(out12)
%%%% disp(out13)
%%%% disp(out14)
%%%% disp(out15)
%%%% disp(out16)
%
clear acceleration;
acceleration=zeros(max(size(t)),2);
acceleration(:,1)=t;
acceleration(:,2)=a_resp';
%
%%% figure(2);
%%% plot(acceleration(:,1),acceleration(:,2));