MATLAB Answers

Moving Window for a specific Time

1 view (last 30 days)
Saad Alqahtani
Saad Alqahtani on 6 Jul 2021
Commented: Saad Alqahtani on 6 Jul 2021
Hi,
So, the goal of this code is to calculate a Coefficient of Variation with time window of 5 seconds.
Here is my code.
% datanabs is a tourque value in Newton Meter
% t =(5*fsamp); moving window of 5 seconds
Mmean = movmean (datanabs,t); % mean of 5 seconds sliding window
Mstd = movstd(datanabs,t); % std of 5 seconds sliding window
CoV = (Mstd./Mmean)*100; % Here where I calcuulte the Coefficient of Variation
It's working but I think there is a better and efficint way to do it. Any help would be appreciated. Thanks in advance.
  2 Comments

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by