How to get the top 5% number and bottom 5% number of a matrix

Asked by Tommy on 27 May 2012
Latest activity Commented on by Tommy on 27 May 2012

After 10000 trajectories of a stochastic differential equation of 55 steps, I get a 10000*55 matrix of results. At present, I want to choose top 5% and bottom 5% of the results in each step, but I do not know which code could help me finish this. Would anyone please help me? Thanks a lot.

0 Comments

Tommy

Tags

Products

No products are associated with this question.

1 Answer

Answer by Oleg Komarov on 27 May 2012
Accepted answer

% Rounded 5%

pt = round(10000*0.05);

% Sort (each column) and take top and bottom 5%

A    = sort(A);
top5 = A(1:pt,:);
bot5 = A(end-pt+1:end,:);

1 Comment

Tommy on 27 May 2012

Thx

Oleg Komarov

Contact us