You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

#### 49 lines 1.8 KiB Matlab Raw Permalink Blame History

 ```function [ResultStruct] = CalculateStrideParametersFunc(dataAccCut_filt,FS,ApplyRemoveSteps,dataAcc,dataAcc_filt,StrideTimeRange) ``` ``` ``` ```%% Calculate stride parameters ``` ```ResultStruct = struct; % create empty struct ``` ``` ``` ```% Run function AutoCorrStrides, Outcomeparameters: StrideRegularity,RelativeStrideVariability,StrideTimeSamples,StrideTime ``` ```[ResultStruct] = AutocorrStrides(dataAccCut_filt,FS, StrideTimeRange,ResultStruct); ``` ```StrideTimeSamples = ResultStruct.StrideTimeSamples; % needed as input for other functions ``` ``` ``` ```% Calculate Step symmetry --> method 1 ``` ```ij = 1; ``` ```dirSymm = [1,3]; % Gait Synmmetry is only informative in AP/V direction: See Tura A, Raggi M, Rocchi L, Cutti AG, Chiari L: Gait symmetry and regularity in transfemoral amputees assessed by trunk accelerations. J Neuroeng Rehabil 2010, 7:4. ``` ``` ``` ```for jk=1:length(dirSymm) ``` ``` [C, lags] = AutocorrRegSymmSteps(dataAccCut_filt(:,dirSymm(jk))); ``` ``` [Ad,p] = findpeaks(C,'MinPeakProminence',0.2, 'MinPeakHeight', 0.2); ``` ``` ``` ``` if size(Ad,1) > 1 ``` ``` Ad1 = Ad(1); ``` ``` Ad2 = Ad(2); ``` ``` GaitSymm(:,ij) = abs((Ad1-Ad2)/mean([Ad1+Ad2]))*100; ``` ``` else ``` ``` GaitSymm(:,ij) = NaN; ``` ``` end ``` ``` ij = ij +1; ``` ```end ``` ```% Save outcome in struct; ``` ```ResultStruct.GaitSymm_V = GaitSymm(1); ``` ```ResultStruct.GaitSymm_AP = GaitSymm(2); ``` ``` ``` ```% Calculate Step symmetry --> method 2 ``` ```[PksAndLocsCorrected] = StepcountFunc(dataAccCut_filt,StrideTimeSamples,FS); ``` ```LocsSteps = PksAndLocsCorrected(2:2:end,2); ``` ``` ``` ```if rem(size(LocsSteps,1),2) == 0; % is number of steps is even ``` ``` LocsSteps2 = LocsSteps(1:2:end); ``` ```else ``` ``` LocsSteps2 = LocsSteps(3:2:end); ``` ```end ``` ``` ``` ```LocsSteps1 = LocsSteps(2:2:end); ``` ```DiffLocs2 = diff(LocsSteps2); ``` ```DiffLocs1 = diff(LocsSteps1); ``` ```StepTime2 = DiffLocs2(1:end-1)/FS; % leave last one out because it is higher ``` ```StepTime1 = DiffLocs1(1:end-1)/FS; ``` ```SI = abs((2*(StepTime2-StepTime1))./(StepTime2+StepTime1))*100; ``` ```ResultStruct.GaitSymmIndex = nanmean(SI); ``` ```end ```