Last change
on this file since 286 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
File size:
880 bytes
|
Rev | Line | |
---|
[2] | 1 | %An objective function for the low-autocorrelation problem.
|
---|
| 2 | %Author: Ofer M. Shir, 2004; oshir@liacs.nl.
|
---|
| 3 | %-----------------------------------------------------------------------
|
---|
| 4 | function [f] = merit (pop)
|
---|
| 5 | % Given a population of binary sequences, this function calculates
|
---|
| 6 | % the merit function according to the formula specified in the exercise
|
---|
| 7 | % description. The input pop is the given matrix.
|
---|
| 8 | % The 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 | %Calculated efficiently in a matrix-notation; auxilary matrices - Y1,Y2
|
---|
| 14 | %- are initialized in every iteration. They are shifted form of the
|
---|
| 15 | %original y vectors. The diaganol of the dot-squared Y2*Y1 matrix is
|
---|
| 16 | %exactly the inner sum of merit function.
|
---|
| 17 | for k=1:n-1
|
---|
| 18 | Y1=pop(1:n-k,:)
|
---|
| 19 | Y2=pop(k+1:n,:)'
|
---|
| 20 | E=E+((diag(Y2*Y1)).^2)'
|
---|
| 21 | end
|
---|
| 22 |
|
---|
| 23 | %The output:
|
---|
| 24 | f = (n*n*ones(1,m))./(2*E)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.