detect change of acceleration

Hello!
I'm doing a 2D video gait analysis on a treadmill and have a problem determining the initial contact.
I know that you can detect the IC approximately with the acceleration change of the heel marker.
Can someone tell me how to find out the change of the acceleration from negative to positive from the following values (the values consist of the coordinates of the heel marker over the period of 5 gait cycles)?
The data are in the appendix
Thank you for your ideas and your time!

6 comentarios

darova
darova el 6 de Sept. de 2019
What about findpeaks()?
Paul Himsl
Paul Himsl el 6 de Sept. de 2019
okay, but how do i get from the coordinates to the acceleration?
Adam Danz
Adam Danz el 6 de Sept. de 2019
Editada: Adam Danz el 6 de Sept. de 2019
Acceleration is the derivative of velocity.
Velocity is the rate of change of position (distance/time).
You can use diff() to compute both. (or gradient as darova mentioned below)
For example, diff(data) is the distance between each sample. The inverse of your sampling rate is time between each sample. So velocity is just diff(data)/(1/sampRate).
Then acceleration is just diff(velocity) assuming a fixed sampling rate.
darova
darova el 6 de Sept. de 2019
I like gradient() more
Adam Danz
Adam Danz el 6 de Sept. de 2019
Paul Himsl's answer moved here as a comment.
Thank you very much für your help!
Adam Danz
Adam Danz el 6 de Sept. de 2019
happy to help (along with darova).
Let us know if you get stuck;

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
Star Strider el 6 de Sept. de 2019
I am not certain what you want with respect to marking acceleration changes.
Try this:
D = load('data.mat');
data = double(D.data);
L = numel(data);
Ts = 1;
t = linspace(0, 1, L)*Ts; % Create Time Vector
Fs = 1/Ts;
Fn = Fs/2;
Wp = 0.200; % Passband Frequency (Normalised)
Ws = 0.350; % Stopband Frequency (Normalised)
Rp = 1; % Passband Ripple
Rs = 50; % Passband Ripple (Attenuation)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp); % Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^16, Fs) % Filter Bode Plot
data_filt = filtfilt(sos, g, data); % Filter Signal
ddata_filt = gradient(data_filt); % Time Derivative
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector
didx = zci(ddata_filt);
for k = 1:numel(didx)-1
idx = didx(k)-1:didx(k)+1;
tz(k) = interp1(ddata_filt(idx), t(idx), 0); % Zero-Crossing Times
dataval(k) = interp1(t(idx),data(idx), tz(k)); % ‘data’ Values At ‘tz’
end
figure
plot(t, data)
hold on
plot(t, data_filt)
plot(t, ddata_filt*25)
plot(tz, dataval, '+r', 'MarkerSize',10)
hold off
grid
legend('data','data\_filt','ddata\_filt','Inflection Points', 'Location','S')
Your data do not have much noise, although they have enough to affect the derivative calculation, so the filter appears to be necessary. Also, the inflection points do not include the last point, because that is usually difficult to determine correctly with this method.
The findpeaks function might be able to do this more efficiently, however you mentioned that you want the points where the direction changes, so I used that criterion rather than the peak values and locations.
Experiment to get the result you want.

Preguntada:

el 6 de Sept. de 2019

Respondida:

el 6 de Sept. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by