Trouble with spikes.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Paulo Eduardo Beiral
am 3 Okt. 2019
Kommentiert: Rik
am 8 Okt. 2019
Hi all.
I've got a matrix called "turb" 2112x2688, which contains many outliers values. What I need is to remove those outliers values, and I tought about the folowing statistical method:
- Find the mean and standart deviation values of which one of the 2688 columns;
- Use two alternatives: Remove all the values in the column higher than it's respective mean value and Remove all the values in the column higher than it's respective standart deviation value;
- Replace these removedvalues with NaN.
Using the mean value of the matrix as a whole wouldn't fit well for my result, because the given mean value is too low and would remove too many components of the matrix, that's why using the mean value of which column fits better.
If anyone could give me any advice of how could I start building up this kind of script, I would be really thankfull!!
Regards, Paulo Beiral.
0 Kommentare
Akzeptierte Antwort
Rik
am 3 Okt. 2019
Here you can see the power of Matlab. What you want can be in a few short lines of code:
x=rand(2112,2688);
avg=mean(x);%or explicitly: avg=mean(x,1)
%sd=std(x);%or explicitly: sd=std(x,1)
L= x<=avg;%for R2016b and later
%L=bsxfun(@le,x,avg);%for R2016a and earlier
x(L)=NaN;
2 Kommentare
Paulo Eduardo Beiral
am 8 Okt. 2019
Bearbeitet: Paulo Eduardo Beiral
am 8 Okt. 2019
Rik
am 8 Okt. 2019
What have you tried to track down the issue? I don't see a strong indication that there is anything wrong with the code itself, except that you're possibly overwriting your variable inside the loop.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Hypothesis Tests finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!