Create a logical array based on signal thresholds
이전 댓글 표시
How can i create a logical array of zeros and ones based on a threshold (mean +- 3SD) of my signal? I would like to assign a 0 whenever the signal (FxRMS) is above the UpperFxThreshold and below the LowerFxThreshold. When the signal is between these two threshold levels, then i would like to assign a 1. I have plotted the logical array (code below) against my data however, it is incorrect, and i am unsure of how to correct it. I have attached a copy of the script that i have written and example data.
i
%Create a logical array of force data, where: force above and or below threshold limit = 0,
%and force between threshold limits = 1
FxLogic = zeros(size(FxRMS));
for iiFx = 500:numel(FxRMS)
if FxRMS(iiFx)>UpperFxThresh
FxLogic(iiFx) = 0;
elseif FxRMS(iiFx)<LowerFxThresh
FxLogic(iiFx) = 0;
else LowerFxThresh<FxRMS(iiFx)<UpperFxThresh
FxLogic(iiFx) = 1;
end
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!