# 一种多源信息融合方法及其应用（Matlab代码实现）

## 💂♨️👨‍🎓Matlab代码👨‍🎓♨️💂

%% Start of script
close all;                          % close all figures
clear;                              % clear all variables
clc;                                % clear the command terminal
%% Import and plot sensor data
figure('Name', 'Sensor Data');
axis(1) = subplot(3,1,1);
hold on;
plot(time, Gyroscope(:,1), 'r');
plot(time, Gyroscope(:,2), 'g');
plot(time, Gyroscope(:,3), 'b');
legend('X', 'Y', 'Z');
xlabel('Time (s)');
ylabel('Angular rate (deg/s)');
title('Gyroscope');
hold off;
axis(2) = subplot(3,1,2);
hold on;
plot(time, Accelerometer(:,1), 'r');
plot(time, Accelerometer(:,2), 'g');
plot(time, Accelerometer(:,3), 'b');
legend('X', 'Y', 'Z');
xlabel('Time (s)');
ylabel('Acceleration (g)');
title('Accelerometer');
hold off;
axis(3) = subplot(3,1,3);
hold on;
plot(time, Magnetometer(:,1), 'r');
plot(time, Magnetometer(:,2), 'g');
plot(time, Magnetometer(:,3), 'b');
legend('X', 'Y', 'Z');
xlabel('Time (s)');
ylabel('Flux (G)');
title('Magnetometer');
hold off;
%% Process sensor data through algorithm
AHRS = MadgwickAHRS('SamplePeriod', 1/256, 'Beta', 0.1);
% AHRS = MahonyAHRS('SamplePeriod', 1/256, 'Kp', 0.5);
quaternion = zeros(length(time), 4);
for t = 1:length(time)
AHRS.Update(Gyroscope(t,:) * (pi/180), Accelerometer(t,:), Magnetometer(t,:));    % gyroscope units must be radians
quaternion(t, :) = AHRS.Quaternion;
end
%% Plot algorithm output as Euler angles
% The first and third Euler angles in the sequence (phi and psi) become
% unreliable when the middle angles of the sequence (theta) approaches �90
% degrees. This problem commonly referred to as Gimbal Lock.
% See: http://en.wikipedia.org/wiki/Gimbal_lock
euler = quatern2euler(quaternConj(quaternion)) * (180/pi);    % use conjugate for sensor frame relative to Earth and convert to degrees.
figure('Name', 'Euler Angles');
hold on;
plot(time, euler(:,1), 'r');
plot(time, euler(:,2), 'g');
plot(time, euler(:,3), 'b');
title('Euler angles');
xlabel('Time (s)');
ylabel('Angle (deg)');
legend('\phi', '\theta', '\psi');
hold off;
%% End of script

## 📜📢🌈参考文献🌈📢📜

[1]陈科文,张祖平,龙军.多源信息融合关键问题、研究进展与新动向[J].计算机科学,2013,40(08):6-13.

|
1月前

25 2
|
1月前
|

MATLAB|【免费】融合正余弦和柯西变异的麻雀优化算法SCSSA-CNN-BiLSTM双向长短期记忆网络预测模型

51 3
|
1月前
|

41 7
|
1月前
|
SQL 移动开发 算法
MATLAB改进模糊C均值聚类FCM在电子商务信用评价应用：分析淘宝网店铺数据|数据分享
MATLAB改进模糊C均值聚类FCM在电子商务信用评价应用：分析淘宝网店铺数据|数据分享
24 1
|
1月前
|

38 1
|
1月前
|

28 0
|
1月前
|

37 0
|
1月前
|

38 0
|
1月前
|

36 1
|
1月前

81 1