How do I use rmoutliers without using rmoutliers

4 views (last 30 days)
I have to do the rmoutliers function for an assignment without using the rmoutliers function. I believe I need to use a while loop, but I am still unfamiliar with the syntax
Essentially for the while loop I want is to check each value in a vector and check to see if it is outside the threshold and an outlier, return the index and replace the value with []
The threshold is based off of the mean +- 3*std of the vector just like the rmoutliers function
This is the exact function I am trying to replicate:
[B,TF] = rmoutliers(___) also returns a logical vector corresponding to the rows or columns of A that were removed.
  5 Comments
Connor Tamaki
Connor Tamaki on 22 Jan 2021
the outlier detection is iterative with the mean and std being calculated each time. I know i'm supposed to do a while loop, but I don't know which condition to loop with
Walter Roberson
Walter Roberson on 22 Jan 2021
while true
calculate the current standard deviation
determine whether there are any current points
that are beyond the threshold based upon standard deviation
if there are none, exit the loop
otherwise there must be some. Delete them.
end

Sign in to comment.

Answers (0)

Categories

Find more on Timetables in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!