Foot strike Data extraction

I am looking to extract some foot strike acceleration data based on a logical square wave of varrying pulse widths (foot incontact with the floor) and assign these to different variables. Bassically when one varialble equals 1 I want to extract a different variable data and store it.

Antworten (1)

Image Analyst
Image Analyst am 6 Dez. 2020

0 Stimmen

Tom: Here is what I have so far (actually it's just what you should have posted originally):
s = load('Foot_strike.mat')
y = s.footcontact;
left = y.left;
acceleration = y.acceleration;
subplot(2, 1, 1);
plot(left, 'b-', 'LineWidth', 2);
title('Left', 'FontSize', 20);
grid on;
subplot(2, 1, 2);
plot(acceleration(:, 1), 'r-', 'LineWidth', 2);
hold on;
plot(acceleration(:, 2), 'g-', 'LineWidth', 2);
plot(acceleration(:, 3), 'b-', 'LineWidth', 2);
legend('1', '2', '3');
grid on;
title('Acceleration', 'FontSize', 20);
g = gcf;
g.WindowState = 'maximized';
OK, so now, what do you want to measure when the Left pulse is up near 1? What EXACTLY does "I want to extract a different variable data and store it." mean?

4 Kommentare

Tom Wills
Tom Wills am 6 Dez. 2020
So I want the acceleration data when the top graph =1. For each instant the foot strikes I want the acceleration data saved as a separate variable.
Use logical indexing
% Find all indexes where left == 1
indexes = left == 1;
% Extract the acceleration values at those locations:
accel1 = acceleration(indexes, 1);
accel2 = acceleration(indexes, 2);
accel3 = acceleration(indexes, 3);
Then you can take the means of them or whatever you want to do.
Tom Wills
Tom Wills am 6 Dez. 2020
Hi maybe this photo will clarify the data that I am after. I require the accelerations covered in the areas shown bellow as seperate variables. Using the method you have shown will give me a single vector of the accelerations that I require not indervidual vectors?
Tom, if you want each step individually, you can use regionprops().
% Demo to get mean accelerations for each step.
clc; % Clear the command window.
clear all;
close all;
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
s = load('Foot_strike.mat')
y = s.footcontact;
left = y.left;
acceleration = y.acceleration;
subplot(2, 1, 1);
plot(left, 'b-', 'LineWidth', 2);
title('Left', 'FontSize', 20);
grid on;
subplot(2, 1, 2);
plot(acceleration(:, 1), 'r-', 'LineWidth', 2);
hold on;
plot(acceleration(:, 2), 'g-', 'LineWidth', 2);
plot(acceleration(:, 3), 'b-', 'LineWidth', 2);
legend('1', '2', '3');
grid on;
title('Acceleration', 'FontSize', 20);
g = gcf;
g.WindowState = 'maximized';
% Find all indexes where left == 1
stepIndexes = left == 1;
% Get the average accelerations for each step.
% First for column1 of acceleration:
props1 = regionprops(stepIndexes, acceleration(:, 1), 'MeanIntensity');
accel1 = [props1.MeanIntensity] % Mean accelerations over the step, for all steps.
% First for column 2 of acceleration:
props2 = regionprops(stepIndexes, acceleration(:, 2), 'MeanIntensity');
accel2 = [props2.MeanIntensity] % Mean accelerations over the step, for all steps.
% First for column 3 of acceleration:
props3 = regionprops(stepIndexes, acceleration(:, 3), 'MeanIntensity');
accel3 = [props3.MeanIntensity] % Mean accelerations over the step, for all steps.

Melden Sie sich an, um zu kommentieren.

Produkte

Gefragt:

am 6 Dez. 2020

Kommentiert:

am 6 Dez. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by