I want to calculate de distance travelled and the instantaneous velocity of a vehicle. Trough a sensor and a dented gear wheel a pulse signal has been recorded. It is known that the vehicle travels 0.1092 m between 2 pulses.
The velocity varies considerably thus the pulses width vary acoordingly, and occasionally, the signal suffers from interference from another device, causing a temporary amplitude increase. A segment is exemplified in figure.1 below:
My approach so far has not fulfilled the analysis objective (distance and velocity calculation/plot).
I've tried to smooth and bandpass the signal as to get rid of HF and be able to identify each pulse as a peak, demonstrated in figure.2 below:
pulseSignalAvg = medfilt1(pulseSignal,60,'truncate');
pulseSignalAvg_Bp = BANDPASS_fFP(pulseSignalAvg, flo, fhi, order, Fs, phase);
title ('bandpass signal Peaks');
legend('Bpass pulses','peaks','smoothed pulses');
In the figure above stretch, the approach works well. I can identify the peaks and calculate the distance, and from the samples between them calculate the velocity. Though this is possible because the velocity at the exemplified stretch is fairly constant at 80km/h, as such the parameters from findpeaks 'MinPeakProminence', 'MinPeakDistance' and bandPass choosen work well. But, for stretches of different velocities results are not suitable. Figure.3 below, shows the same bandpass and findpeaks paremeters results, but for an accelerating stretch, where no longer I could get one peak per pulse.
With this approach, finding a combination of parameters that work for variable velocities seems not achievable...I guess a different approach is required to tackle this problem.
Please find figures 1, 2 and 3 attached, as well as an example pulse signal file (.mat)
I would kindly ask the community for some tips on solving this issue.