repflag=true;
Mostra commenti meno recenti
hi there.. i am converting matlab codes which have "repflag=true" i don't understand this kindly someone guide me...
thanks in advance.
10 Commenti
David Goodmanson
il 28 Dic 2019
Hi Sher,
impossible to say since you have not provided any context. Regardless, what you could do at least as well as anyone on this site is scan down through the rest of the code until you find
if repflag % or possibly if repflag==true
blah
blah
blah
end
and try to scope out what it does.
Sher Akbar
il 28 Dic 2019
David Goodmanson
il 29 Dic 2019
is 'data' a vector, or is it a matrix?
Walter Roberson
il 29 Dic 2019
The code appears to be looping replacing outiers with the mean of the data, until finally there are no more outliers.
Sher Akbar
il 29 Dic 2019
David Goodmanson
il 29 Dic 2019
HI Sher,
best to figure out what it's doing, then write a new version in R. The comment says it's recursion, but it's really iteration.
Using ns = 3 as an example, then as Walter mentioned, take the outlier measurements that lie more than 3 standard deviations away from the mean, and replace them by the mean. That makes a new data set. Then find a new mean and standard deviation and repeat the process until there are no more outliers. Why someone would use that process is a question worth asking, if you don't know already.
During the process, count up the outliers on each side of the mean. The spikes = (spikes ==1) statement seems to be in order to avoid double counting any outliers, same for drops.
Sher Akbar
il 29 Dic 2019
Sher Akbar
il 29 Dic 2019
David Goodmanson
il 29 Dic 2019
Hi Sher, I don't know R and redoing this in R is not really within the scope of this website.
Sher Akbar
il 29 Dic 2019
Risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!