版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.加速度积分位移matlab2013-02-04 05:30:00|分类: matlab应用 |举报 |字号 订阅最近做有关加速度的数据处理,需要把加速度积分成位移,网上找了找相关资料,发现做这个并不多,把最近做的总结一下吧!积分操作主要有两种方法:时域积分和频域积分,积分中常见的问题就是会产生二次趋势。关于积分的方法,在国外一个论坛上有人提出了如下说法,供参考。double integration of raw acceleration data is a pretty poor estimate for displacement.the reason is that at each int
2、egration, you arecompounding the noise in the data .if you are dead set on working in thetime-domain , the best results come from the following steps.1. remove the mean from your sample (now have zero-mean sample)2. integrate once to get velocity using some rule (trapezoidal, etc.)3. remove the mean
3、 from the velocity4. integrate again to get displacement.5. remove the mean. note, if you plot this, you will see drift over time.6. to eliminate (some to most) of the drift (trend), use a least squares fit (high degree depending on data) to determine polynomial coefficients.7. remove the least squa
4、res polynomial function from your data.a much better way to get displacement from acceleration data is to work in the frequency domain . to do this, follow these steps.1. remove the mean from the accel. data2. take the fourier transform (fft) of the accel. data.3. convert the transformed accel. data
5、 to displacement data by dividing each element by -omega2, where omega is the frequency band.4. now take the inverse fft to get back to the time-domain and scale your result. this will give you a much better estimate of displacement.说到底就是频域积分要比时域积分效果更好,实际测试也发现如此 。原因可能是时域积分时积分一次就要去趋势,去趋势就会降低信号的能量,所以最
6、后得到的结果常常比真实幅值要小。下面做一些测试,对一个正弦信号的二次微分做两次积分,正弦频率为 50hz,采样频率 1000hz,恢复效果如下时域积分.频域积分可见恢复信号都很好(对于50hz 是这样的效果)。.分析两种方法的频率特性曲线如下时域积分频域积分.可以看到频域积分得到信号更好,时域积分随着信号频率的升高恢复的正弦幅值会降低。对于包含两个正弦波的信号,频域积分正常恢复信号,时域积分恢复的高频信息有误差; 对于有噪声的正弦信号,噪声会使积分结果产生大的趋势项(不是简单的二次趋势), 如下图.对此可以用滤波的方法将大的趋势项去掉。测试的代码 如下% 测试积分对正弦信号的作用clcclea
7、rclose all% 原始正弦信号ts = 0.001;fs = 1/ts;t = 0:ts:1000*ts;f = 50;dis = sin(2*pi*f*t); %位移vel = 2*pi*f.*cos(2*pi*f*t); %速度acc = -(2*pi*f).2.*sin(2*pi*f*t); %加速度% 多个正弦波的测试% f1 = 400;% dis1 = sin(2*pi*f1*t); % 位移% vel1 = 2*pi*f1.*cos(2*pi*f1*t); %速度% acc1 = -(2*pi*f1).2.*sin(2*pi*f1*t); %加速度% dis = dis +
8、 dis1;% vel = vel + vel1;.% acc = acc + acc1;% 结:频域积分正常恢复信号,时域积分恢复加入的高频信息有误差% 加噪声测试acc = acc + (2*pi*f).2*0.2*randn(size(acc);% 结:噪声会使积分结果产生大的趋势项figureax(1) = subplot(311);plot(t, dis), title( 位移 )ax(2) = subplot(312);plot(t, vel), title( 速度 )ax(3) = subplot(313);plot(t, acc), title(加速度 )linkaxes(ax
9、, x);% 由加速度信号积分算位移disint, velint = intfcn(acc, t, ts, 2);axes(ax(2);hold onplot(t, velint, r), legend( 原始信号 , 恢复信号 )axes(ax(1);hold onplot(t, disint, r), legend( 原始信号 , 恢复信号 )% 测试积分算子的频率特性n = 30;amp = zeros(n, 1);f = 5:30 40:10:480;figurefor i = 1:length(f)fi = f(i);acc = -(2*pi*fi).2.*sin(2*pi*fi*t
10、); %加速度disint, velint = intfcn(acc, t, ts, 2); % 积分算位移amp(i) = sqrt(sum(disint.2)/sqrt(sum(dis.2);plot(t, disint)drawnow% pauseendclosefigureplot(f, amp)title( 位移积分的频率特性曲线)xlabel(f)ylabel(单位正弦波的积分位移幅值)以上代码中使用 intfcn 函数实现积分,它是封装之后的函数,可以实现时域积分和频域积分 ,其代码如下.% 积分操作由加速度求位移,可选时域积分和频域积分function disint, veli
11、nt = intfcn(acc, t, ts, flag)if flag = 1% 时域积分disint, velint = intfcn_time(t, acc);velenergy = sqrt(sum(velint.2);velint = detrend(velint);velreenergy = sqrt(sum(velint.2);velint = velint/velreenergy*velenergy;disenergy = sqrt(sum(disint.2);disint = detrend(disint);disreenergy = sqrt(sum(disint.2);d
12、isint = disint/disreenergy*disenergy; % 此操作是为了弥补去趋势时能量的损失% 去除位移中的二次项p = polyfit(t, disint, 2);disint = disint - polyval(p, t);else% 频域积分velint = iomega(acc, ts, 3, 2);velint = detrend(velint);disint = iomega(acc, ts, 3, 1);% 去除位移中的二次项p = polyfit(t, disint, 2);disint = disint - polyval(p, t);endend其中
13、时域积分的子函数 如下% 时域内梯形积分function xn, vn = intfcn_time(t, an)vn = cumtrapz(t, an);vn = vn - repmat(mean(vn), size(vn,1), 1);xn = cumtrapz(t, vn);xn = xn - repmat(mean(xn), size(xn,1), 1);end频域积分的子函数 如下(此代码是一个老外编的,在频域内实现积分和微分操作)function dataout = iomega(datain, dt, datain_type, dataout_type)% %.% % % iome
14、ga is a matlab script for converting displacement, velocity, or% acceleration time-series to either displacement, velocity, or% acceleration times-series. the script takes an array of waveform data% (datain), transforms into the frequency-domain in order to more easily% convert into desired output f
15、orm, and then converts back into the time% domain resulting in output (dataout) that is converted into the desired% form.% variables:% -%datain=input waveform data of type datain_type%dataout= output waveform data of type dataout_type%dt=time increment (units of seconds per sample)%1- displacement%
16、datain_type = 2 - velocity%3- acceleration%1- displacement%dataout_type = 2 - velocity%3- acceleration% % % make sure that datain_type and dataout_type are either 1, 2 or 3 if (datain_type 3)error(value for datain_type must be a 1, 2 or 3); elseif (dataout_type 3)error(value for dataout_type must be
17、 a 1, 2 or 3); end% determine number of points (next power of 2), frequency increment% and nyquist frequency.n = 2nextpow2(max(size(datain);df = 1/(n*dt);nyq = 1/(2*dt);%save frequency arrayiomega_array = 1i*2*pi*(-nyq : df : nyq-df);iomega_exp = dataout_type - datain_type;% pad datain array with ze
18、ros (if needed) size1 = size(datain,1);size2 = size(datain,2);if (n-size1 = 0 & n-size2 = 0) if size1 size2datain = vertcat(datain,zeros(n-size1,1);elsedatain = horzcat(datain,zeros(1,n-size2);endend% transform datain into frequency domain via fft and shift output (a)% so that zero-frequency amplitude is in the middle of
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 长治市潞城市2025届三年级数学第二学期期中学业水平测试试题含解析
- 长沙市浏阳市2025届数学四下期末达标测试试题含答案解析
- 高校教师教学能力提升计划
- (2026年)医院质控年终工作总结
- 电梯安装工程公司实习心得体会
- (2026版)学校内部矛盾纠纷排查处理制度
- 《秋词》课外古诗词诵读课件
- 新苏教版科学六年级上册第一单元单元整体教学设计
- 2025年重庆市铜梁区数学中考模拟卷
- 广东省珠海市香洲区凤凰中学2024-2025学年九年级上学期语文期中试卷(解析版)
- 煤矿安全生产标准化管理体系2024版与2026版对比分析报告
- 2026年湖南省岳阳市高一下学期期末考试数学试卷(含参考答案)
- 2026年版初中历史八年级下册复习提纲(表格型)
- 二级公共营养师《专业技能》试卷真题及解析(2026年)
- 2026年北京医师定期考核法律法规复习试题(附答案)
- 2026年高考全国一卷地理真题解析含答案
- 2025年山东省青岛市辅警考试题库(含答案)
- 焊工考试题库及焊工证模拟考试(及答案)
- 2026秋人教版九年级英语上册单词默写
- 长护险照护人员考核制度
- 2026年上海市徐汇区初三下学期二模物理试卷及参考答案
评论
0/150
提交评论