【使用 DSP 滤波器加速速度和位移】使用信号处理算法过滤加速度数据并将其转换为速度和位移研究(Matlab代码实现)

news/2025/2/22 5:06:07/

 💥💥💞💞欢迎来到本博客❤️❤️💥💥

 

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

对于实时采集的加速度数据,可以应用信号处理算法,如数字滤波和积分运算,将其转换为速度和位移数据。下面是一个简要的概述:

1. 数据采集:首先需要进行数据采集,通过传感器获取物体的加速度数据。这可以通过加速度计等传感器来实现,例如使用微电机惯性测量单元(IMU)或加速度传感器。

2. 数字滤波:为了去除噪声和不必要的高频分量,可以应用数字滤波技术,如低通滤波器。常见的滤波器类型包括巴特沃斯滤波器、无限脉冲响应(IIR)滤波器和有限脉冲响应(FIR)滤波器。滤波后的信号将更加平滑和稳定。

3. 数值积分:将经过滤波的加速度信号积分一次,可以得到速度信号。数值积分是通过近似求解离散点间的微分来实现的。积分操作会导致积分误差的累积,因此需要考虑误差修正和积分漂移校准的方法。

4. 二次积分:将经过滤波和积分的速度信号再次积分,可以得到位移信号。同样,二次积分也会引入积分误差的累积,因此需要对误差进行校正和修正。

5. 校准和校正:为了获得准确的结果,可能需要进行传感器的校准和校正。这包括零偏校准、灵敏度校准和加速度计的温度效应校正等。

需要注意的是,将加速度数据转换为速度和位移的过程是一个近似计算,其中存在积分误差的累积,尤其是在长时间的测量中。因此,在进行精确位移测量时,需要考虑积分误差的校准和修正。

总结来说,将加速度数据转换为速度和位移的过程包括数据采集、数字滤波、数值积分和二次积分。每个步骤都需要选择合适的算法和参数,并进行校准和修正,以获得准确可靠的速度和位移结果。

📚2 运行结果

部分代码:

%% Processed inputs
%--------------------------------------------------------------------------
time   = data(:,1);         % Time vector
accval_g = data(:,2);       % Acceleration in g
accval = data(:,2)*9.81;    % Acceleration in m/s^2
L = size(data,1);           % Length of signal
Fs = 1/(time(2)-time(1));   % Sampling frequency                    
Ts = 1/Fs;                  % Sampling period       

%% Displacement, Velocity and Acceleration
%--------------------------------------------------------------------------
[~, ~, ~, filtered_acc_g] ...
          = accelo2disp(time,Ts, Fs, Fcut,alpha, accval_g, Lvdtmat,...
                            lvdtcons, accbiasV, accsensi, filtertype...
                            ,filtermethod,firorder);
                        
[LVDTfilt, filtered_disp, filtered_vel, filtered_acc] ...
          = accelo2disp(time,Ts, Fs, Fcut,alpha, accval, Lvdtmat,...
                            lvdtcons, accbiasV, accsensi, filtertype...
                            ,filtermethod,firorder);

%% Compute the frequency
%--------------------------------------------------------------------------
% Compute the Fourier transform of the signal.
Y = fft(filtered_acc);

% Compute the two-sided spectrum P2. Then compute the single-sided spectrum P1 
% based on P2 and the even-valued signal length L.
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);

% Define the frequency domain f and plot the single-sided amplitude spectrum P1.
% On average, longer signals produce better frequency approximations.
f = Fs*(0:(L/2))/L;

%% Plot Acceleration vs.time
%--------------------------------------------------------------------------
figure;
subplot(5,2,1)
ax1 = plot(time, accval_g, 'LineWidth', 1);
grid on
xlabel('Time ($sec.$)','Interpreter', 'latex');
ylabel('Acceleration ($g$)','Interpreter', 'latex');
title('Acceleration vs.time (with DC bias)')

ax2 = subplot(5,2,2);
plot(time, filtered_acc_g, 'LineWidth', 1)
grid on
xlabel('Time ($sec.$)','Interpreter', 'latex');
ylabel('Acceleration ($g$)','Interpreter', 'latex');
title('Acceleration vs.time (DC bias removed)')

ax3 = subplot(5,2,3:4);
plot(time,filtered_acc, 'LineWidth', 1)
grid on
xlabel('Time ($sec.$)','Interpreter', 'latex');
ylabel('Acceleration ($\frac{m}{s^2}$)','Interpreter', 'latex');
title('Acceleration vs.time (DC bias removed)')

ax4 = subplot(5,2,5:6);
plot(time,filtered_vel, 'LineWidth', 1)
grid on
xlabel('Time ($sec.$)','Interpreter', 'latex');
ylabel('Velocity ($\frac{m}{s}$)','Interpreter', 'latex');
title('Velocity vs.time')

ax5 = subplot(5,2,7:8);
plot(time,filtered_disp, 'LineWidth', 1)
grid on
xlabel('Time ($sec.$)','Interpreter', 'latex');
ylabel('Displacement ($m$)','Interpreter', 'latex');
title('Displacement vs.time')

ax6 = subplot(5,2,9:10);
plot(f,P1, 'LineWidth', 1)
grid on
title('Frequency Spectrum of Acceleration')
xlabel('f(Hz)')
ylabel('|P1(f)|')

🎉3 参考文献

部分理论来源于网络,如有侵权请联系删除。

1. 王思远, 张逸凡. (2016). 基于MEMS加速度计测量的速度和位移测量方法. 精仪与检测技术, 4, 29-32.

2. 刘兆岑, 张进杰, 吴树荣等. (2018). 加速度传感器信号滤波技术及其在位移测量中的应用. 自动化仪表, 39(5), 38-42.

3. 马靖蒙, 黄艺帆, 赵晨曦等. (2017). 基于自适应滤波和积分的加速度测速算法. 机械工程学报, 53(3), 68-74.

4. 高素平, 汪思悦, 毛亚伟等. (2016). 基于加速度测量的振动位移自适应无源解调算法. 哈尔滨工程大学学报, 37(5), 683-688.

🌈4 Matlab代码实现


http://www.ppmy.cn/news/992116.html

相关文章

【数据结构与算法】归并排序

归并排序 归并排序(MERGE-SORT)是利用归并的思想实现的排序方法,该算法采用经典的分治(divide-and-conquer)策略(分治法将问题分(divide)成一些小的问题然后递归求解,而…

2023杭电多校第二场部分题解

剩下还有些题以后再补…… 索引 10011002100410071009101010111012 1001 据说是从Kayles游戏拓展来的,这个游戏在网上都没啥资料……大概是这样的: 有一列石子,每次可以取走一个或连续的两个,每次取走后剩下的石子在原位置不动&…

C语言实现定时器,定时触发函数

最近想到使用C语言实现一个简单的定时器。使用操作系统windows.h提供的多线程API就能实现 首先定义一个定时器结构体,包含定时时间和触发的函数指针 typedef struct Stimer{int valid;//定时器有效long timingMS;//定时时间TriggerFunc tf;//触发函数 }Stimer;创建…

Vue+axios如何解决跨域

1、为什么会产生跨域? 出于浏览器的同源策略限制。 同源策略(Sameoriginpolicy)是一种约定,是浏览器的一种安全机…

【Python】将M4A\AAC录音文件转换为MP3文件

文章目录 m4aaac 基础环境: sudo apt-get install ffmpegm4a 要将M4A文件转换为MP3文件,你可以使用Python中的第三方库pydub。pydub使得音频处理变得非常简单。在开始之前,请确保你已经安装了pydub库,如果没有,可以通…

(树) 剑指 Offer 27. 二叉树的镜像 ——【Leetcode每日一题】

❓剑指 Offer 27. 二叉树的镜像 难度:简单 请完成一个函数,输入一个二叉树,该函数输出它的镜像。 例如输入: 4/ \2 7/ \ / \1 3 6 9镜像输出: 4/ \7 2/ \ / \9 6 3 1示例 1: 输…

Times New Roman对应的latex

在LaTeX中,可以使用以下命令将文字设置为Times New Roman字体: \usepackage{times} 然后,将文档正文部分包含在以下命令之间: \begin{document} … \end{document} 这样,文档正文中的文字将以Times New Roman字体呈…

list与流迭代器stream_iterator

运行代码: //list与流迭代器 #include"std_lib_facilities.h" //声明Item类 struct Item {string name;int iid;double value;Item():name(" "),iid(0),value(0.0){}Item(string ss,int ii,double vv):name(ss),iid(ii),value(vv){}friend ist…