Create a logical array based on signal thresholds
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!