I am trying to make a system that detects footsteps. First I filter and decimate the original signal, then I make a convolution between the filtered signal and a single footstep, then I extract the envelope (here I have a threshold of 1 and if the peaks exceed this threshold then it means that those are footsteps). The problem is that the plots (envelope and footsteps) need to be correlated, but the footsteps are right shifted and I really don't know which might be the cause. I hope you can help me. I'll show you an example of two different signals.
convolutie=conv(filtrare2,sample); t=(0:length(convolutie)-1)/Fs; axes(handles.semnalConv); plot(t,convolutie);xlabel('Time(s)'); y = hilbert(convolutie); env = abs(y); t=(0:length(env)-1)/Fs; axes(handles.semnalAnvelopa); plot(t,env);xlabel('Time(s)'); [pks,locs]=findpeaks(env,'MinPeakHeight',1,'MinPeakDistance',100); axes(handles.semnalPasi); stem(locs.*10,pks.^(1/2)/4,'r');
The problem was that there was a different number of samples at each plot.