checker.m

来自「matlab 在线性代数中的应用 利用matlab实现可以提高对所学知识的理解 」· M 代码 · 共 13 行

M
13 行
字号
function C=checker(n)
% The command C=checker(n) generates an nxn matrix C
% whose entries alternate between 1 and 0. Specifically
% C(i,j)=1 if i+j is even, otherwise C(i,j)=0. For example
% the command checker(4) will generate  the matrix
%
%       1  0  1  0
%       0  1  0  1
%       1  0  1  0
%       0  1  0  1
C=ones(n,1)*[1:n];
C=rem(C+C'+1,2);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?