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', '-')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值