Ignore anomalies in collection of datasets

조회 수: 3 (최근 30일)
MADRobot
MADRobot 2020년 6월 29일
댓글: MADRobot 2020년 6월 30일
I want to ignore anomalies in datasets contained within a for loop. However, I'm not sure how to do this where:
  • i = number of rows, and my code will step through it to produce an animation made up of >1000 frames. For example:
RPtoT = [RASIS(i,:); RT2(i,:); RT3(i,:)];
LPtoT = [LASIS(i,:); LT0(i,:); LT1(i,:)];
I want to exlude anomolies that cause my markers to jump around. For example, half way through the moving figure, a few markers will suddenly jump from an x position of 2000 to 0 - I want to be able to ignore these, so almost filter the data, but I don't know how to do this and apply it to a lot more data similar to the code displayed above.
for i = 1:1033
if i<10
i = [NaN]; % I want the values contained within i to be neglected if they randomly bounce towards zero
else
i = i;
end
I don't want to have to go through 50+ datasets with a matrices of 1000+ by 3 and set anomalies to NaN, so is there an easier way to do this?

답변 (1개)

Steven Lord
Steven Lord 2020년 6월 29일
Preprocess your data to identify, fill, and/or remove outliers. Use the functions in the "Missing Data and Outliers" section on that page or use the Live Editor Task "Clean Outlier Data" also described on that page.
  댓글 수: 1
MADRobot
MADRobot 2020년 6월 30일
I've tried to integrate this into my current code, but it doesn't seem to be working.
An example of how I've done this:
[cleanedData,outlierIndices] = rmoutliers([L5MT LLMal LMMal LAnkle R5MT RLMal RMMal RAnkle], 'ThresholdFactor',6);
I've also tried applying it as:
[cleanedData,outlierIndices] = rmoutliers(R5MT, 'ThresholdFactor',6);
[cleanedData,outlierIndices] = rmoutliers(RLMal, 'ThresholdFactor',6);
[cleanedData,outlierIndices] = rmoutliers(RMMal, 'ThresholdFactor',6);
[cleanedData,outlierIndices] = rmoutliers(RAnkle, 'ThresholdFactor',6);
It doesn't seem to be making any difference for some reason, I'm pretty sure I'm doing something wrong but I don't know what I'm doing wrong.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by