Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [average,variance,meanCrossings,derivativeZeroCrossings] = calculateForTimeWindow(sampleSize,d)
- [height,~]=size(d);
- parts = (ceil(height/sampleSize));
- cells = mat2cell(d, size(d,1)/parts.*ones(parts,1), 5);
- average = cellfun(@mean,cells,'UniformOutput',false);
- variance = cellfun(@var,cells,'UniformOutput',false);
- zcd = dsp.ZeroCrossingDetector;
- meanCrossings = cellfun(@(x,idx) zcd(x-average{idx}),cells,transpose(num2cell(1:parts)),'UniformOutput',false);
- release(zcd);
- derivativeZeroCrossings = cellfun(@(x) zcd(diff(x)/(1/sampleSize)),cells,'UniformOutput',false);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement