How to calculate moving Gradient feature of a signal?

3 Ansichten (letzte 30 Tage)
Muhammad Hammad Malik
Muhammad Hammad Malik am 16 Feb. 2021
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

Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by