# Adding outlier to a matrix

7 Ansichten (letzte 30 Tage)
Niki am 22 Mai 2014
Kommentiert: Star Strider am 22 Mai 2014
Hi , I have a matrix of intensities (n*p). I want to add an outlier to it. Do you have any idea about how to simulate an outlier? I was thinking to take the mean of matrix and then multiply it to some very high value?
Do you have any idea ?
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Star Strider am 22 Mai 2014
I suggest:
M = rand(4,5); % Create data
Msts = [mean(M(:)) std(M(:))];
Outlier = Msts(1)+5*Msts(2);
Define the outlier by a multiple of the standard deviation from the mean. An value of 5*std is quite far out.
##### 8 Kommentare6 ältere Kommentare anzeigen6 ältere Kommentare ausblenden
Niki am 22 Mai 2014
Not that one but this one helps
OutsXR = mean(X,1) + 5*std(X,[],1);
Star Strider am 22 Mai 2014
My pleasure, and thanks!

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Roger Wohlwend am 22 Mai 2014
Actually you answered your question yourself. Instead of the mean I would use the maximum value of the matrix. Multiply that number by a certain value. That's all. It is quite easy.
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Niki am 22 Mai 2014
In fact, I want to know whether it is scientifically correct or not? It is not a number. As I explained it is a matrix of n*p so I wont have a value as outlier but a row which corresponds as an outlier
On the other hand, do you know any way to show it as a outlier ?

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Creating and Concatenating Matrices 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!

Translated by