%
%   iso_apply_sine.m  ver 1.2   December 20, 2011
%
function[q]=iso_apply_sine(rd_trans_x,rd_trans_y,rd_trans_z,trans_x,trans_y,trans_z)
    q=1;
    disp(' ');
    disp(' Apply steady-state sine vibration base input? ');
    disp(' 1=yes  2=no ');
    isine = input(' ');
%
    if(isine==1)
        while(1)
            disp(' ');
            disp(' Enter input axis ');
            disp(' 1=X  2=Y  3=Z ');
            iaxis=input(' ');
            disp(' ');
            disp(' Enter frequency (Hz) ');
            freq=input(' ');
            disp(' ');
            disp(' Enter amplitude (G) ');
            amp=input(' ');
            clear length;
            clear f;
            f=trans_x(:,1);
            nnn=length(f)-1;
%
            ax=0;
            ay=0;
            az=0;
            rdx=0;
            rdy=0;
            rdz=0;  
%
            for(i=1:nnn)
                if(freq>=f(i) && freq<=f(i+1))
                    x=freq-f(i);
                    L=f(i+1)-f(i);
                    c2=x/L;
                    c1=1-c2;
                    if(iaxis==1)
                        tx=c1*trans_x(i,2)+c2*trans_x(i+1,2);
                        ty=c1*trans_x(i,3)+c2*trans_x(i+1,3);
                        tz=c1*trans_x(i,4)+c2*trans_x(i+1,4);
                        ax=amp*tx;
                        ay=amp*ty;
                        az=amp*tz;
                        tx=c1*rd_trans_x(i,2)+c2*rd_trans_x(i+1,2);
                        ty=c1*rd_trans_x(i,3)+c2*rd_trans_x(i+1,3);
                        tz=c1*rd_trans_x(i,4)+c2*rd_trans_x(i+1,4);                    
                        rdx=amp*tx;
                        rdy=amp*ty;
                        rdz=amp*tz;      
                        break;         
                    end
                    if(iaxis==2)
                        tx=c1*trans_y(i,2)+c2*trans_y(i+1,2);
                        ty=c1*trans_y(i,3)+c2*trans_y(i+1,3);
                        tz=c1*trans_y(i,4)+c2*trans_y(i+1,4);
                        ax=amp*tx;
                        ay=amp*ty;
                        az=amp*tz;
                        tx=c1*rd_trans_y(i,2)+c2*rd_trans_y(i+1,2);
                        ty=c1*rd_trans_y(i,3)+c2*rd_trans_y(i+1,3);
                        tz=c1*rd_trans_y(i,4)+c2*rd_trans_y(i+1,4);                    
                        rdx=amp*tx;
                        rdy=amp*ty;
                        rdz=amp*tz;      
                        break;                 
                    end               
                    if(iaxis==3)
                        tx=c1*trans_z(i,2)+c2*trans_z(i+1,2);
                        ty=c1*trans_z(i,3)+c2*trans_z(i+1,3);
                        tz=c1*trans_z(i,4)+c2*trans_z(i+1,4);
                        ax=amp*tx;
                        ay=amp*ty;
                        az=amp*tz;
                        tx=c1*rd_trans_z(i,2)+c2*rd_trans_z(i+1,2);
                        ty=c1*rd_trans_z(i,3)+c2*rd_trans_z(i+1,3);
                        tz=c1*rd_trans_z(i,4)+c2*rd_trans_z(i+1,4);                    
                        rdx=amp*tx;
                        rdy=amp*ty;
                        rdz=amp*tz;                       
                        break;
                    end                          
                end
            end
%
            aa=[ ax ay az ];
            amax=max(abs(aa));
%
            for(i=1:3)
                if(abs(aa(i))< (amax/10000) || abs(aa(i))< 1.0e-10)
                    aa(i)=0;
                end
            end
%
            disp(' ');
            disp(' Acceleration Response ');
            out1=sprintf('  X-axis:  %8.4g G',aa(1));
            out2=sprintf('  Y-axis:  %8.4g G',aa(2));
            out3=sprintf('  Z-axis:  %8.4g G',aa(3));
            disp(out1);
            disp(out2);
            disp(out3);
%
            rr=[ rdx rdy rdz ];
            rmax=max(abs(rr));
%
            for(i=1:3)
                if(abs(rr(i))< (rmax/10000) || abs(rr(i))< 1.0e-10)
                    rr(i)=0;
                end
            end
%        
            disp(' ');
            disp(' Relative Displacement Response ');
            out1=sprintf('  X-axis:  %8.4g in',rr(1));
            out2=sprintf('  Y-axis:  %8.4g in',rr(2));
            out3=sprintf('  Z-axis:  %8.4g in',rr(3));
            disp(out1);
            disp(out2);
            disp(out3);
%
            disp(' ');
            disp(' Perform another sine base input case? ');
            disp(' 1=yes  2=no ');
            ian=input(' ');
            if(ian==2)
                break;
            end
        end
%
    end   