clc;
close all;
X=load("8g25odr.txt");%
length = length(X);
acc_x=X(:,1);
acc_y=X(:,2);
acc_z=X(:,3);
figure
% title('RAW signal ')
plot(acc_x);
hold on
plot(acc_y);
hold on
plot(acc_z);
%求均值
MEANacc_x=mean(acc_x);
MEANacc_y=mean(acc_y);
MEANacc_z=mean(acc_z);
% 平方差和
SUMacc_x=0;
SUMacc_y=0;
SUMacc_z=0;
for i=1:length
SUMacc_x= SUMacc_x+((abs(acc_x(i)) - abs(MEANacc_x)).^2);
SUMacc_y= SUMacc_y+((abs(acc_y(i)) - abs(MEANacc_y)).^2);
SUMacc_z= SUMacc_z+((abs(acc_z(i)) - abs(MEANacc_z)).^2);
end
%根据灵敏度求均方误差
RMSEeacc_x=sqrt(SUMacc_x/length)*1000/512;
RMSEeacc_y=sqrt(SUMacc_y/length)*1000/512;
RMSEeacc_z=sqrt(SUMacc_z/length)*1000/512;