# how can I create a series of same length vectors, extract from each the maximum number, and collect the maximum numbers in a new vector?

1 view (last 30 days)
Paolo Ottonelli on 7 Jul 2016
Answered: KSSV on 8 Jul 2016
if true
b=5;
muH=b*sqrt(pi/2);
n=100000; % n different vectors
H= rand(1,1000);
h=(muH/mean(H))* H; %vector
max=zeros(1,n);
for k=1:n %it creates n different vectors each containing 1000 numbers
max=max(h(k)); %extract maximum from each n vectors
end
end
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Accepted Answer

KSSV on 8 Jul 2016
clc; clear all ;
b=5;
muH=b*sqrt(pi/2);
n=100000; % n different vectors
iwant=zeros(1,n);
for k=1:n %it creates n different vectors each containing 1000 numbers
H= rand(1,1000);
h=(muH/mean(H))* H; %vector
iwant(k)=max(h); %extract maximum from each n vectors
end
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Categories

Find more on Simulink in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!