Download a robust navigation system using gps, mems inertial sensors and

Transcript
legend('Angular rate', 'Angular rate (Filter)', 'Angular displacement');
% PeakNum = 0;
% number of peaks in the waveform
% Peak(1, :) = 0;
% a vector to store each peak value
% for j = 1:N
% if abs(swing(j)) > 5 % 5 degree will be the smallest displacement
%
Begin = j;
% any displacement smaller than this
%
break;
% will not be considered
% end
% end
% for j = Begin:N-1
% finding the peaks
% if ((swing(j) > swing(j+1)) && (swing(j) > swing(j-1)) ...
%
|| (swing(j) < swing(j+1)) && (swing(j) < swing(j-1)))
%
PeakNum = PeakNum + 1;
%
Peak(PeakNum) = j;
% end
% end
%
% i = 0;
% StrideAngle(1, :) = 0; % difference between two peaks
% for j = 2:PeakNum
% is the StrideAngle
% i = i + 1;
% if abs(swing(Peak(j)) - swing(Peak(j-1))) > 10
%
StrideAngle(i) = abs(swing(Peak(j)) - swing(Peak(j-1)));
% end
% end
pks = findpeaks(swing);
i = 1;
k = numel(pks);
while i <= k
if pks(i) < 5
pks(i) = [];
else
i = i + 1;
end
k = numel(pks);
end
StrideAngle = pks;
Distance = 0;
% calculate distance
L = 1.06;
% length of my leg (meter)
for j = 1:size(StrideAngle, 2)
Distance = Distance + L * sqrt(2 * (1 - cosd(StrideAngle(j))));
end
% ----------------------------------------------------------------% 7. Display all the info
% ----------------------------------------------------------------disp(['File name: ', filename]);
disp(['Data sampled: ', num2str(N),' entries ']);
disp(['Sampling Rate: ', num2str(Fs),' Hz ']);
disp(['Test Time: ', num2str(totaltime),' sec ']);
disp(['Walked:
', num2str(numel(pks)), ' steps ']);
200