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!