Last change
on this file since 144 was 46, checked in by Rick van der Zwet, 15 years ago |
Report finished = sleep
|
-
Property svn:keywords
set to
Id
|
File size:
903 bytes
|
Line | |
---|
1 | % An objective function for the low-autocorrelation problem.
|
---|
2 | % Author: Ofer M. Shir, 2004; oshir@liacs.nl.
|
---|
3 | %-----------------------------------------------------------------------
|
---|
4 | function [f] = autocorrelation(pop)
|
---|
5 | % Given a population of binary sequences, this function calculates
|
---|
6 | % the merit function according to the formula specified in the
|
---|
7 | % exercise description. The input pop is the given matrix. The
|
---|
8 | % output f is the merit factor calculated (row vector).
|
---|
9 |
|
---|
10 | n = size(pop,1);
|
---|
11 | m = size(pop,2);
|
---|
12 | E = zeros(1,m);
|
---|
13 |
|
---|
14 | % Calculated efficiently in a matrix-notation; auxilary matrices -
|
---|
15 | % Y1,Y2 - are initialized in every iteration. They are shifted form
|
---|
16 | % of the original y vectors. The diagonal of the dot-squared Y2*Y1
|
---|
17 | % matrix is exactly the inner sum of merit function.
|
---|
18 | for k=1:n-1
|
---|
19 | Y1=pop(1:n-k,:);
|
---|
20 | Y2=pop(k+1:n,:)';
|
---|
21 | E=E+((diag(Y2*Y1)).^2)';
|
---|
22 | end
|
---|
23 |
|
---|
24 | % The output:
|
---|
25 | f = (n*n*ones(1,m))./(2*E);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.