test.m 618 B

1234567891011121314151617181920212223242526272829
  1. clear ;%清除工作区的缓存变量
  2. close all; % 关闭当前的所有窗口
  3. clc; %清除命令行的数据
  4. data_file = xlsread('../imusavedata_zhengxuelong3.xlsx');
  5. gyr_data = data_file(:, 1:3) * pi/180;
  6. g = 9.7833;
  7. acc_data = data_file(:, 4:6) /1.2098 * g;
  8. press_data = data_file(:,7:8)';
  9. data_size = size(gyr_data,1);
  10. pos_result =zeros(3,data_size);
  11. for i = 1 : data_size
  12. pos = footPDR(i, gyr_data(i,:)', acc_data(i,:)',press_data(2,i));
  13. pos_result(:,i) = pos;
  14. end
  15. figure('NumberTitle', 'off', 'Name', 'Offset pos');
  16. hold on;
  17. plot(pos_result(1,:), 'r');
  18. plot(pos_result(2,:), 'g');
  19. plot(pos_result(3,:), 'b');
  20. grid on