Calculate mean of knee angle of five gait cycles

6 visualizzazioni (ultimi 30 giorni)
Hello!
I have data from several measurements of the knee angle during the gait cycle. In total there are five cycles per measurement. ~180 values per cycle
I want to cut every single cycle (so that i have five individual cycles), normalize them (so they have all the same length --> 100% of gaitcycle) and then build the mean of the five gait cycles.
Unfortunately, the cycles have not always the same length - so the cycles cannot be cut each time at the same point.
I know how to interpolate the individual steps to the same length and then build the mean, but I don't know how to cut the individual cycles
Do any of you have any idea?
Thank you very much for your time and help.
That's the data on my five gait cycles:
data=[124.99817;125.44993;126.06261;126.62725;126.96901;126.85249;126.72809;
126.69195;126.89260;127.22283;127.55982;127.89953;128.26324;128.59187;
128.95186;129.36115;129.83044;130.32272;130.80785;131.28342;131.81282;
132.28973;132.76274;133.25055;133.73625;134.19824;134.64732;134.97369;
135.30815;135.60210;135.79669;135.95656;136.03963;136.11223;136.15367;
136.11076;135.99701;135.86121;135.76257;135.62810;135.54721;135.38263;
135.15903;134.96083;134.73497;134.62605;134.52530;134.47028;134.38138;
134.27184;134.15657;134.10222;134.02858;133.89824;133.84692;133.84053;
133.76653;133.70103;133.62411;133.60797;133.61992;133.63516;133.66196;
133.70590;133.74820;133.75381;133.71320;133.74275;133.76660;133.65123;
133.66029;133.70778;133.68716;133.66071;133.60437;133.59258;133.57278;
133.50835;133.49715;133.47237;133.48972;133.53731;133.59171;133.67665;
133.70338;133.75362;133.89154;133.96317;134.03842;134.16014;134.24319;
134.33476;134.44508;134.53380;134.58372;134.65015;134.75896;134.87216;
134.94426;134.98097;134.99345;135.02110;135.00018;134.95076;134.87413;
134.78697;134.68819;134.62303;134.58749;134.56696;134.55292;134.56393;
134.61618;134.66792;134.76239;134.88028;135.04218;135.17238;135.29564;
135.45009;135.67938;135.89819;136.10713;136.32283;136.58997;136.86868;
137.21709;137.62187;138.10571;138.59393;139.11688;139.63310;140.15898;
140.72815;141.30266;141.85272;142.43054;142.95781;143.50130;144.08847;
144.71780;145.32870;145.95663;146.69441;147.41127;148.16206;148.98457;
149.75009;150.54201;151.36317;152.13293;153.05898;154.01634;154.92853;
155.87764;156.88843;157.95302;159.11295;160.08955;161.12122;162.16560;
163.20300;164.36931;165.55487;166.72325;167.80928;168.70201;169.48195;
169.97348;170.28299;170.27986;170.09444;169.67587;169.05217;168.22192;
167.25731;166.15141;164.81514;163.47154;162.13141;160.69984;159.23482;
157.67216;156.07195;154.42888;152.78877;151.16782;149.50601;147.81693;
146.15294;144.44127;142.65376;140.81471;139.06935;137.35918;135.59683;
133.83691;132.33099;130.87271;129.46317;128.09465;126.81647;125.63887;
124.65022;123.81573;123.14413;122.64118;122.32346;122.10559;122.07442;
122.22430;122.45194;122.85918;123.44131;124.02830;124.61389;125.00122;
125.05925;124.85418;124.46637;124.07992;123.88861;123.85097;123.93670;
123.96120;123.95282;123.97343;124.11148;124.32552;124.54559;124.83865;
125.22063;125.54175;125.87177;126.20709;126.55631;126.87137;127.16113;
127.44092;127.73185;128.00993;128.31226;128.65787;128.96811;129.24776;
129.55728;129.87003;130.08827;130.36523;130.71680;131.00166;131.24236;
131.46919;131.64348;131.76424;131.93092;132.06656;132.15245;132.19588;
132.25740;132.32443;132.40831;132.42250;132.46683;132.46568;132.40089;
132.34068;132.29750;132.32466;132.35327;132.31035;132.34901;132.42609;
132.45271;132.49065;132.47116;132.50572;132.51559;132.51099;132.49043;
132.43170;132.46190;132.46539;132.37508;132.33028;132.28004;132.27098;
132.25681;132.25407;132.34042;132.39403;132.45688;132.57651;132.69740;
132.82265;132.95813;133.09602;133.23376;133.39023;133.56679;133.72878;
133.92934;134.16771;134.43689;134.72188;134.98418;135.23294;135.48976;
135.79704;136.13351;136.49213;136.86421;137.29250;137.73491;138.17662;
138.62376;139.06766;139.51675;139.91980;140.25529;140.56830;140.79893;
141.01236;141.22128;141.35675;141.51727;141.64064;141.76199;141.94038;
142.17627;142.44501;142.68896;143.05449;143.46280;143.92786;144.49483;
145.02371;145.72649;146.44235;147.15016;147.96085;148.83711;149.79315;
150.82260;151.99513;153.34990;154.79089;156.38783;158.03859;159.65599;
161.30437;162.93834;164.61555;166.26308;167.82495;169.36635;170.70108;
171.75485;172.39461;172.89111;173.16769;173.21422;173.07526;172.79945;
172.36020;171.83647;171.00429;170.07550;169.09735;167.99759;166.70959;
165.40564;163.97945;162.55618;161.02481;159.52698;157.98874;156.38364;
154.81972;153.24825;151.58095;149.83214;148.15935;146.55249;144.98900;
143.41968;141.73329;140.09732;138.58517;137.05586;135.75316;134.52180;
133.44083;132.41402;131.60510;130.88834;130.20195;129.75612;129.45197;
129.28415;129.26332;129.39752;129.68126;130.08858;130.56349;130.90590;
131.04483;130.90099;130.33847;129.73270;129.19740;128.95149;129.09790;
129.14040;129.10512;129.04834;129.13771;129.27997;129.48851;129.79335;
130.09686;130.39589;130.68843;130.97693;131.26811;131.57152;131.86830;
132.09154;132.35466;132.56923;132.72498;132.94321;133.16740;133.42619;
133.66284;133.82365;133.99091;134.11836;134.28748;134.42261;134.55771;
134.73842;134.93713;135.18506;135.38768;135.64326;135.92937;136.15656;
136.46806;136.79938;137.03496;137.36909;137.65419;137.93594;138.21959;
138.60770;138.97072;139.35329;139.72102;140.14543;140.55531;141.02390;
141.43494;141.82668;142.19629;142.59653;142.85011;143.03168;143.32486;
143.52815;143.76961;144.01082;144.19185;144.39449;144.53922;144.69647;
144.86629;145.01250;145.04204;145.12076;145.24017;145.34213;145.45023;
145.50775;145.59097;145.65222;145.59026;145.66406;145.73634;145.80937;
145.81956;145.77208;145.79248;145.76910;145.73282;145.68025;145.68544;
145.62820;145.64714;145.60423;145.48003;145.37248;145.21844;145.01901;
144.79689;144.60542;144.22134;143.96759;143.52075;143.17133;142.91971;
142.58069;142.28276;142.06519;141.90004;141.71875;141.69376;141.64677;
141.62756;141.70683;141.84711;142.03343;142.28610;142.62714;143.21758;
143.79297;144.40396;145.11491;145.93211;146.80414;147.74127;148.69298;
149.64558;150.61699;151.61841;152.53839;153.51004;154.47743;155.41910;
156.32333;157.19876;158.06021;159.08804;159.96405;160.96967;162.13670;
163.21623;164.30124;165.41092;166.47742;167.45651;168.52711;169.59766;
170.67180;171.75299;172.76213;173.86163;174.97180;175.90460;176.65994;
177.41684;178.12601;178.41010;178.53926;178.48627;178.19626;177.72772;
177.10944;176.31870;175.39470;174.36212;173.12283;171.83644;170.48656;
168.96025;167.42047;165.92476;164.27565;162.79071;161.33211;159.89436;
158.43861;157.07004;155.74797;154.45961;153.19188;151.97438;150.76315;
149.54875;148.23505;146.96049;145.71353;144.42123;143.04866;141.74196;
140.43350;139.13840;137.91641;136.74336;135.71564;134.84538;134.01765;
133.32008;132.76776;132.30983;132.04471;131.94012;131.99870;132.34598;
132.64581;132.78590;132.64287;132.31909;132.22691;132.27940;132.49094;
132.64729;132.73888;132.81807;132.84274;132.90169;132.91747;132.97343;
133.10759;133.30893;133.45219;133.60944;133.89868;134.16074;134.45692;
134.81540;135.19066;135.51741;135.82928;136.12627;136.54460;136.80800;
136.98325;137.03693;137.16978;137.28795;137.37122;137.42888;137.47865;
137.49600;137.50551;137.51070;137.29620;137.16899;136.91975;136.81377;
136.62779;136.53610;136.40565;136.33101;136.31525;136.30087;136.23541;
136.19826;136.13870;136.13022;136.04698;136.03630;135.91847;135.87877;
135.90417;135.83749;135.80508;135.74435;135.76405;135.73199;135.75412;
135.70555;135.68596;135.77397;135.61430;135.77303;135.74576;135.73776;
135.75221;135.75671;135.79434;135.89697;135.86504;135.92799;135.91591;
135.91226;135.99417;136.02866;136.00732;136.08885;136.18201;136.24796;
136.27731;136.35336;136.40948;136.46457;136.52681;136.57930;136.62938;
136.59055;136.60092;136.68431;136.77284;136.77115;136.79378;136.86859;
136.98819;137.05811;137.04242;137.12929;137.12093;137.12770;137.17000;
137.20023;137.10353;137.00734;136.95641;136.98216;136.96069;137.02959;
137.10497;137.17201;137.23619;137.39102;137.56621;137.77505;138.04976;
138.31102;138.58725;138.93021;139.31406;139.75050;140.25165;140.82047;
141.49631;142.21817;143.03175;143.99126;144.99312;146.04453;147.21443;
148.52499;149.77814;151.10159;152.50580;153.81236;155.16478;156.46445;
157.74059;158.92918;160.04855;161.15234;162.20506;163.24364;164.16209;
164.76494;165.11513;165.37529;165.48074;165.29167;164.89801;164.32074;
163.55894;162.67416;161.75003;160.72258;159.68100;158.49974;157.11479;
155.84369;154.50883;153.11766;151.66078;150.25752;148.90375;147.41850;
145.89998;144.27379;142.77472;141.24666;139.62857;138.09290;136.43884;
134.90503;133.43559;131.90025;130.35690;128.86279;127.44368;126.07414;
124.79926;123.61330;122.67424;121.83175;121.18526;120.58865;120.23268;
120.06229;120.05629;120.31679;120.82523;121.50742;122.39161;123.19366;
123.61041;123.73112;123.67705;123.88772;124.38536;125.07375;125.80409;
126.42697;127.02280;127.67799;128.36523;129.22658;130.05867;130.86407;
131.80820;132.57231;133.34174;134.14119;134.90015;135.67336;136.47302;
137.27623;137.97572;138.65331;139.24323;139.65894;140.13870;140.56520;
140.97313;141.34880;141.63300;141.92700;142.20026;142.59767;142.71971;
142.88864;143.01534;143.19189;143.18916;143.24950;143.36908;143.50076;
143.65715;143.86421;144.15274;144.22876;144.32590;144.43100;144.53232;
144.57669;144.61053;144.61230;144.56575;144.50832;144.42805;144.31094;
144.34807;144.25389;144.14720;144.05511;143.87651;143.73311;143.49637;
143.22446;142.99590;142.82669;142.52460;142.14218;141.81837;141.64259;
141.42294;141.05746;140.71002;140.38521;140.09749;139.84602;139.60571;
139.40028;139.23015;139.06396;138.85544;138.72006;138.57205;138.47562;
138.40227;138.35037;138.29012;138.27599;138.30661;138.30127;138.24931;
138.25011;138.26041;138.26566;138.28644;138.27147;138.21774;138.17471;
138.19958;138.17760;138.22971;138.27296;138.35014;138.44640;138.57253;
138.75081;138.92026;139.10825;139.32359;139.54901;139.78569;140.03053;
140.27011;140.57294;140.90338;141.20415;141.50764;141.83484;142.18817;
142.61624;143.08794;143.55675;144.18497;144.87326;145.60712;146.43872;
147.32645;148.25352;149.27745;150.38327;151.45575;152.57430;153.74020;
154.98753;156.21342;157.48267;158.84148;160.14157;161.46687;162.84830;
164.18254;165.52031;166.80855;168.05623;169.20935;170.37492;171.48293;
172.62267;173.87881;175.24477;176.46986;177.61961;178.58765;179.37193;
179.94066;179.81339;179.80417;179.89532;179.48451;178.98355;178.22755;
177.30434;176.39876;175.39082;174.33040;173.00255;171.59505;170.15781;
168.54985;166.97305;165.49492;163.95877;162.38940;160.73878;159.11427;
157.53674;155.86848;154.15044;152.43355;150.80977;149.25214;147.67407;
146.10385;144.71066;143.37317;142.07542;140.75102;139.68475;138.69826;
137.86400;137.16698;136.68741;136.31259;135.92912;135.92822];
  6 Commenti
Rik
Rik il 6 Set 2019
The splitting seems to work reasonably well if you just select blocks of 200. Otherwise you could look in how to find local minima.
darova
darova il 6 Set 2019
I'd split it this way:
A = load('data.txt');
A = reshape(A,[],5);
plot(A)

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 6 Set 2019
Two options, both using findpeaks:
[pks,locs] = findpeaks(data, 'MinPeakHeight',160, 'MinPeakDistance',100); % Peaks
figure
plot(data)
hold on
plot(locs, pks, '+r')
hold off
grid
[npks,nlocs] = findpeaks(-data, 'MinPeakHeight',-135, 'MinPeakDistance',100); % Valleys
figure
plot(data)
hold on
plot(nlocs, -npks, '+r')
hold off
grid
Experiment to get the result you want.
  1 Commento
Paul Himsl
Paul Himsl il 6 Set 2019
Yes! Great!
that's what i needed, i didn't think of such a solution
Thanks to all of you for your suggestions.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by