Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.61 KB | None | 0 0
  1. function [average,variance,meanCrossings,derivativeZeroCrossings] = calculateForTimeWindow(sampleSize,d)
  2.     [height,~]=size(d);
  3.     parts = (ceil(height/sampleSize));
  4.     cells = mat2cell(d, size(d,1)/parts.*ones(parts,1), 5);
  5.     average = cellfun(@mean,cells,'UniformOutput',false);
  6.     variance = cellfun(@var,cells,'UniformOutput',false);
  7.     zcd = dsp.ZeroCrossingDetector;
  8.     meanCrossings = cellfun(@(x,idx) zcd(x-average{idx}),cells,transpose(num2cell(1:parts)),'UniformOutput',false);
  9.     release(zcd);
  10.     derivativeZeroCrossings = cellfun(@(x) zcd(diff(x)/(1/sampleSize)),cells,'UniformOutput',false);
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement