# How to create initial population of 100 random set of coefficient for design filter using genetic algorithm?

조회 수: 3(최근 30일)
The vector contain a 51 coefficients ,and i want to random a vector 100 times (initialization in GA),what is the method ?does it is create a function give me every time a different vector, or random the same vector?

댓글을 달려면 로그인하십시오.

### 채택된 답변

Dimitris Kalogiros 9 Aug 2018
Hi Johan
I suggest the following script:
% Generation of N sets of coefficients. Each set of contains M values
N=100; %number of sets
M=51; % number of coefficients inside each set
Range.low=-1; %upper limit of coeff's value
Range.up=1; %lower limit of coeff's value
taps=zeros(N,M);
for n=1:N
taps(n,1:M)=Range.low+(Range.up-Range.low)*rand(1,M); %generation of one set of taps
end
I generate sets of taps one at a time , cause you maybe want to add a correlation between sucessive sets.
Off course, all sets of coefficients can be created instantaneously:
taps=Range.low+(Range.up-Range.low)*rand(N,M);

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!

Translated by