C  * * * * * * * * * * * * * * * * * * * * * * * * * *                  
C     SUBROUTINE FOR RESPONSE OF SINGLE-DOF SYSTEM                      
C  * * * * * * * * * * * * * * * * * * * * * * * * * *                  
C                                                                       
C                                CODED BY Y.OHSAKI                      
C                                                                       
C     PURPOSE                                                           
C       TO COMPUTE ABSOLUTE ACCELERATION, RELATIVE VELOCITY AND RELA-   
C       TIVE DISPLACEMENT RESPONSE TIME HISTORIES AND THEIR MAXIMA OF   
C       A SINGLE DEGREE-OF-FREEDOM SYSTEM WITH GIVEN NATURAL FREQUENCY  
C       AND DAMPING FACTOR EXCITED BY GIVEN ACCELERATIONS               
C                                                                       
C     USAGE                                                             
C       CALL RESP(H,W,DT,NN,DDY,ACC,VEL,DIS,ND,SA,SV,SD)                
C                                                                       
C     DESCRIPTION OF ARGUMENTS                                          
C       H       - DAMPING FACTOR IN DECIMAL FRACTION                    
C       W       - NATURAL CIRCULAR FREQUENCY IN RAD/SEC                 
C       DT      - TIME INCREMENT IN TIME HISTORIES IN SEC               
C       NN      - TOTAL NUMBER OF DATA IN TIME HISTORIES                
C       DDY(ND) - GIVEN ACCELERATION TIME HISTORY IN GALS               
C       ACC(ND) - ABSOLUTE ACCELERATION RESPONSE TIME HISTORY IN GALS   
C       VEL(ND) - RELATIVE VELOCITY RESPONSE TIME HISTORY IN KINES      
C       DIS(ND) - RELATIVE DISPLACEMENT RESPONSE TIME HISTORY IN CENTI- 
C                 METERS                                                
C       ND      - DIMENSION OF DDY,ACC,VEL,DIS IN CALLING PROGRAM       
C       SA      - MAX. ABSOLUTE ACCELERATION RESPONSE IN GALS           
C       SV      - MAX. RELATIVE VELOCITY RESPONSE IN KINES              
C       SD      - MAX. RELATIVE DISPLACEMENT RESPONSE IN CENTIMETERS    
C                                                                       
C     SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED                     
C       NONE                                                            
C                                                                       
      SUBROUTINE RESP(H,W,DT,NN,DDY,ACC,VEL,DIS,ND,SA,SV,SD)            
C                                                                       
      DIMENSION DDY(ND),ACC(ND),VEL(ND),DIS(ND)                         
C                                                                       
      W2=W*W                                                            
      HW=H*W                                                            
      WD=W*SQRT(1.-H*H)                                                 
      WDT=WD*DT                                                         
      E=EXP(-HW*DT)                                                     
      CWDT=COS(WDT)                                                     
      SWDT=SIN(WDT)                                                     
      A11= E*(CWDT+HW*SWDT/WD)                                          
      A12= E*SWDT/WD                                                    
      A21=-E*W2*SWDT/WD                                                 
      A22= E*(CWDT-HW*SWDT/WD)                                          
      SS=-HW*SWDT-WD*CWDT                                               
      CC=-HW*CWDT+WD*SWDT                                               
      S1=(E*SS+WD)/W2                                                   
      C1=(E*CC+HW)/W2                                                   
      S2=(E*DT*SS+HW*S1+WD*C1)/W2                                       
      C2=(E*DT*CC+HW*C1-WD*S1)/W2                                       
      S3=DT*S1-S2                                                       
      C3=DT*C1-C2                                                       
      B11=-S2/WDT                                                       
      B12=-S3/WDT                                                       
      B21=(HW*S2-WD*C2)/WDT                                             
      B22=(HW*S3-WD*C3)/WDT                                             
      ACC(1)=2.*H*W*DDY(1)*DT                                           
      VEL(1)=-DDY(1)*DT                                                 
      DIS(1)=0.                                                         
      DX=VEL(1)                                                         
      X=0.                                                              
      SA=0.                                                             
      SV=0.                                                             
      SD=0.                                                             
      DO 110 M=2,NN                                                     
      DXF=DX                                                            
      XF=X                                                              
      DDYM=DDY(M)                                                       
      DDYF=DDY(M-1)                                                     
      X= A12*DXF+A11*XF+B12*DDYM+B11*DDYF                               
      DX=A22*DXF+A21*XF+B22*DDYM+B21*DDYF                               
      DDX=-2.*HW*DX-W2*X                                                
      ACC(M)=DDX                                                        
      VEL(M)=DX                                                         
      DIS(M)=X                                                          
      SA=AMAX1(SA,ABS(DDX))                                             
      SV=AMAX1(SV,ABS(DX))                                              
      SD=AMAX1(SD,ABS(X))                                               
  110 CONTINUE                                                          
      RETURN                                                            
      END                                                               
                                                                        
