首页 > 编程知识 正文

matlab时频分析函数(matlab中时域逐步积分方法,matlab数值积分的实现:时域积分和频域积分.doc)

时间:2023-05-05 23:11:35 阅读:121342 作者:2082

matlab数值积分的实现:时域积分和频域积分. doc

matlab数值积分的实现时域积分和频域积分操作主要有两种方法时域积分和频域积分,积分中常见的问题是产生二次趋势。 关于积分的确定方法,在海外的某个论坛上有以下说法。 仅供参考。 doubleintegrationofrawaccelerationdataisaprettypoorestimatefordisplacement.thereasonisthatateachintegration, youarecompoundingthenoiseinthedata.ifyouaredeadsetonworkinginthetime-domain, thebestresultscomefromthefollowingsteps.removethemeanfromyoursamplenowhavezero-meansampleintegrateoncetvelocityusingsouro etc.removethemeanfromthevelocityintegrateagaintogetdisplacement.removethemean.note,if you plot this, youwillseedriftovertime.toeliminatesometomostofthedrifttrend, usealeastsquaresfithighdegreedependingondatatodeterminepolynomialcoefficients.removetheleastsquarespolynomialfunctionfromyoution isplacementfromaccelerationdataistoworkinthefrequencydomain.todo this, followthesesteps.removethemeanfromtheaccel.datakethefouriertransformfftoftheaccel.data.convertthetransformedacel.cel l cementdatabydividingeachelementby-omega 2, whereomegaisthefrequencyband.nowtaketheinverseffttogetbacktothetime-domainandscaleyourresult.thiswillgiveyouamuamuchbettetetereteteretetetttettime 这可能是因为,在时域积分中,积分一次就去趋势,而去趋势时信号的能量会下降,因此最终得到的结果往往小于真实振幅。 做一些测试,将一个正弦信号的二次微分以正弦频率50Hz、采样频率1000Hz积分两次。 可以看到,恢复效果在以下时域积分频域积分中恢复信号良好(对于50Hz有这样的效果)。 分析两种方法的频率特性曲线,发现时域积分频域积分信号更好,时域积分随信号频率的升高而恢复的正弦幅度降低,如下。 对于包含两个正弦波信号,频域积分正常恢复信号、时域积分恢复的高频信息存在误差; 有噪声的正弦信号时,由于噪声,积分结果会产生大的趋势项。 不是简单的二次趋势。 下图可以用过滤的方法去除大的趋势项。 测试代码如下测试积分对正弦信号的作用clcclearclose all原始正弦信号ts 0.001; fs 1/ts; t 0ts1000*ts; f 50; dis sin2*pi*f*t; 位移vel 2*pi*f.*cos2*pi*f*t; 速度acc -2*pi*f.2.*sin2*pi*f*t; 多个正弦波的测试f1 400; dis1 sin2*pi*f1*t; 位移vel1 2*pi*f1.*cos2*pi*f1*t; 速度acc1 -2*pi*f1.2.*sin2*pi*f1*t; 加速度dis dis dis1; VELVEL1; acc acc acc1; 结频域积分正常恢复信号、加入时域积分恢复的高频信息有误差噪声测试acca cc2* pi * f.2 * 0.2 * randnsizeacc; 结噪声在积分结果中产生大趋势项figureax1 subplot311; plott、dis、title移位ax2 subplot312; plott,vel,title速度ax3 subplot313; plott,acc,title加速度linkaxesax,x; 加速度信号积分引起的位移[disint,velint] IntFcnacc、t、ts、2; axesax2; hold onplott,velint,r,legend{原始信号,恢复信号}axesax1; 霍尔德on

plott, disint, r,legend{原始信号, 恢复信号} 测试积分算子的频率特性 n 30;amp zerosn, 1;f [530 4010480];figurefor i 1lengthf fi fi; acc -2*pi*fi.2.*sin2*pi*fi*t; 加速度 [disint, velint] IntFcnacc, t, ts, 2; 积分算位移 ampi sqrtsumdisint.2/sqrtsumdis.2; plott, disint drawnowendclosefigureplotf, amptitle位移积分的频率特性曲线xlabelfylabel单位正弦波的积分位移幅值以上代码中使用 IntFcn 函数实现积分,它是封装之后的函数,可以实现时域积分和频域积分,其代码如下 积分操作由加速度求位移,可选时域积分和频域积分function [disint, velint] IntFcnacc, t, ts, flagif flag 1 时域积分 [disint, velint] IntFcn_Timet, acc; velenergy sqrtsumvelint.2; velint detrendvelint; velreenergy sqrtsumvelint.2; velint velint/velreenergy*velenergy; disenergy sqrtsumdisint.2; disint detrenddisint; disreenergy sqrtsumdisint.2; disint disint/disreenergy*disenergy; 此操作是为了弥补去趋势时能量的损失 去除位移中的二次项 p polyfitt, disint, 2; disint disint - polyvalp, t;else 频域积分 velint iomegaacc, ts, 3, 2; velint detrendvelint; disint iomegaacc, ts, 3, 1; 去除位移中的二次项 p polyfitt, disint, 2; disint disint - polyvalp, t;endend其中时域积分的子函数如下 时域内梯形积分 function [xn, vn] IntFcn_Timet, anvn cumtrapzt, an;vn vn - repmatmeanvn, sizevn,1, 1;xn cumtrapzt, vn;xn xn - repmatmeanxn, sizexn,1, 1;end频域积分的子函数如下(此代码是一个老外编的,在频域内实现积分和微分操作)function dataout iomegadatain, dt, datain_type, dataout_type IOMEGA 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 form, 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 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 3if datain_type 3 errorValue for datain_type must be a 1, 2 or 3;elseif dataout_type 3 errorValue for dataout_type must be a 1, 2 or 3;end Determine Number of points next power of 2, frequency increment and Nyquist frequencyN 2nextpow2maxsizedatain;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 zeros if neededsize1 sizedatain,1;size2 sizedatain,2;if N-size1 0 else datain horzcatdatain,zeros1,N-size2; endend Transform datain into frequency domain via FFT and shift output A so that zero-frequency amplitude is in the middle of the array instead of the beginningA fftdatain;A fftshiftA; Convert datain of type datain_type to type dataout_typefor j 1 N if iomega_arrayj 0 Aj Aj * iomega_arrayj iomega_exp; else Aj complex0.0,0.0; endend Shift new frequency-amplitude array back to MATLAB format and transform back into the time domain via the inverse FFT.A ifftshiftA;datain ifftA; Remove zeros that were added to datain in order to pad to next biggerst power of 2 and return dataout.if size1 size2 dataout realdatain1size1,size2;else dataout realdatainsize1,1size2;endreturn 本文转自新浪了凡春秋的博客,博主了凡春秋,中国科技大学。关联阅读A 互相关cross-correlation中的一些概念及其实现 B 振动信号预处理的几个问题滤波、积分、泄漏等 C 振动信号的预处理去趋势项和五点三次平滑法 D 动力学方程数值解法直接积分法(Newmark 类)

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。