20070215-Costas arrays

原文:http://blogs.mathworks.com/steve/2007/02/15/costas-arrays/

A Costas array is a permutation matrix. A permutation matrix contains 0s and 1s such that each row and each column contains only a single 1. The identity matrix is a trivial example:

eye(3)
ans =

     1     0     0
     0     1     0
     0     0     1

In addition to being a permutation matrix, a Costas array has the property that no pair of 1-valued elements has the same vector difference as any other pair. The 3-by-3 identity matrix above does not have this property. The vector difference between the (1,1) element and the (2,2) element is (1,1). This is the same as the vector difference between the (2,2) and (3,3) elements. Here's a visualization of a 10-by-10 Costas array:

v = [2 4 8 5 10 9 7 3 6 1];
n = 10;
plot(1:n, v, 'LineStyle', 'none', 'Marker', 'o', ...
    'MarkerEdgeColor', 'b', 'MarkerFaceColor', 'b')
axis equal
grid on
set(gca, ...
    'XTick', 0.5:(n+0.5), ...
    'YTick', 0.5:(n+0.5), ...
    'XLim', [0.5 (n+0.5)], ...
    'YLim', [0.5 (n+0.5)], ...
    'XTickLabel', '', ...
    'YTickLabel', '', ...
    'GridLineStyle', '-')
And here's a 29-by-29 example:
v = [3 21 23 22 8 15 26 6 16 11 28 5 2 18 10 14 12 13 27 20 9 29 19 ...
    24 7 1 4 17 25];
n = 29;
plot(1:n, v, 'LineStyle', 'none', 'Marker', 'o', ...
    'MarkerEdgeColor', 'b', 'MarkerFaceColor', 'b')
axis equal
grid on
set(gca, ...
    'XTick', 0.5:(n+0.5), ...
    'YTick', 0.5:(n+0.5), ...
    'XLim', [0.5 (n+0.5)], ...
    'YLim', [0.5 (n+0.5)], ...
    'XTickLabel', '', ...
    'YTickLabel', '', ...
    'GridLineStyle', '-')

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章