statistics
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
how to write a script to calculate means and standard deviations for each columns and use these values in such way to subtract mean of column from each element of column then divide the outcome by standard deviation of column. Repeat that for each column .Then from new matrix to pick maximum element out of each column.
1 Kommentar
Walter Roberson
am 21 Jan. 2012
You do not need a loop for any of that. What you do need is to search the MATLAB documentation to find functions to calculate mean and standard deviation.
Antworten (2)
Adam Danz
am 15 Aug. 2018
Here's an example using fake data named 'data'.
% Fake data
data = randi(9,20,5);
% Calculate mean and std for each column
means = mean(data,1);
sd = std(data, [], 1);
% Subtract mean and divide by std
dataNorm = (data - means) ./ sd;
% Max element from each column
dataNormMax = max(dataNorm, [], 1);
Here's the same thing all in 1 line.
dataNormMax = max((data - mean(data,1)) ./ std(data, [], 1), [], 1);
0 Kommentare
Darshan
am 15 Okt. 2025 um 13:13
Bearbeitet: Walter Roberson
am 15 Okt. 2025 um 17:43
Diese(r) Antwort wurde durch Dyuman Joshi
markiert
% Fake data
data = randi(9,20,5);
% Calculate mean and std for each column
means = mean(data,1);
sd = std(data, [], 1);
% Subtract mean and divide by std
dataNorm = (data - means) ./ sd;
% Max element from each column
dataNormMax = max(dataNorm, [], 1);
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!