How to calculate moving Gradient feature of a signal?

4 views (last 30 days)
I want to calculate gradient feature (central difference) from my filtered data with window size=10samples and 50%overlap to previous window.
Here what i have done, i am adding here, and also attaching the image for central difference formula and dummy acceleration data. The issue is i am unable to add window overlap. I also can change the window size to bigger or smaller, not restricted to use just 10. How can do this writing either own code or using gradient function. Looking for kind help.
window=10samples
%Data_filtered is input signal
Grad =gradient(Data_filtered(1:window:end),window)
figure;
%"IMU_ULISS.time" is time
plot(IMU_ULISS.time(1:window:end),Grad)
%modified my time vector to plot it
time_modified=IMU_ULISS.time(1:window:end)
hold onplot(time_modified(ceil(find(IMU_ULISS.step_instant_target(1,:)>0)/window)),Grad(ceil(find(IMU_ULISS.step_instant_target(1,:)>0)/window)),'r');
hold on

Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!