?? acc2dis.m
字號:
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 + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -