acc2dis.m

来自「一种新的时频分析方法的matlab源程序。」· M 代码 · 共 79 行

M
79
字号
function [data]=acc2dis(xa,dt)

% The function ACC2DIS computes velocity and displacement for acceleration data.
% The procedure includes creating the filter by processing the 1st column
% of input data.
% 
% Non MATLAB Library routines used are
%	LEAST,ORMSBY,INTEGR.
%
% Calling sequence-
% [data]=acc2dis(xa,dt) 
%
% Input-
%	xa	    - 2-D matrix xa(m,n) of acceleration data 
%	dt	    - sampling rate in time (delta time)
% Output-
%	data	- [time, acceleration, velocity, displacement], where
%		    time is dimensioned as (m,1)
%		    acceleration is dimensioned as (m,n)
%		    velocity is dimensioned as (m,1)
%		    displacement is dimensioned as (m,1)

%----- Initialize
rf=0.12 ;
tf=0.14 ;
[m,n]=size(xa) ;

%     CORRECTING FOR LINEAR TRENDS BY LEAST SQUARES ADJUSTMENT      
      [cof1,cof2]=least(xa,dt)  ;
      for jj=1:m        ;
         xa(jj,1)=xa(jj,1)-cof1-cof2*jj*dt      ;
      end            
      
      xa=xa'      ;
      [acc]=ormsby(xa,rf,tf,dt,m) ;
      xa=xa'      ;
      acc=acc'    ;
      xa=xa-acc ;
      str=[ 'CORRECTING FOR LINEAR TRENDS BY LEAST SQUARES ADJUSTMENT ' ]

%     ACCELERATION TO VELOCITY
      [xv]=integr(xa,dt)        ;
      str=['ACCELERATION TO VELOCITY']

%     CORRECTING FOR LINEAR TRENDS BY LEAST SQUARES ADJUSTMENT
      [cof1,cof2]=least(xv,dt)  ;
      for jj=1:m        ;
         xv(jj,1)=xv(jj,1)-cof1-cof2*jj*dt      ;
      end            
      
      xv=xv'      ;
      [vel]=ormsby(xv,rf,tf,dt,m) ;
      xv=xv'      ;
      vel=vel'    ;
      xv=xv-vel ;
      str=['CORRECTING FOR LINEAR TRENDS BY LEAST SQUARES ADJUSTMENT']
            
%C    VELOCITY TO DISPLACEMENT
      [xd]=integr(xv,dt)        ;
      str=['VELOCITY TO DISPLACEMENT']
      
%     CORRECTING FOR LINEAR TRENDS BY LEAST SQUARES ADJUSTMENT
      [cof1,cof2]=least(xd,dt)  ;
      for jj=1:m        ;
         xd(jj,1)=xd(jj,1)-cof1-cof2*jj*dt      ;
      end            
      
      xd=xd'   ;
      [dis]=ormsby(xd,rf,tf,dt,m)   ;
      xd=xd'      ;
      dis=dis'    ;
      xd=xd-dis ;
      str=['CORRECTING FOR LINEAR TRENDS BY LEAST SQUARES ADJUSTMENT']

      t=dt:dt:dt*m;
      t=t';
      data=[t xa xv xd];  
   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?