achecker.m

来自「线性代数实验及MATLAB入门,电子工业出版社出版 陈怀琛 龚杰民合著」· M 代码 · 共 16 行

M
16
字号
function A=achecker(n)% The command A=achecker(n) generates an nxn matrix A% whose entries alternate between 1 and 0. Specifically% C(i,j)=1 if i+j is odd, otherwise C(i,j)=0. This matrix% is similar to the checker matrix except the matrix begins% with a 0 as its (1,1) entry while the checker matrix % starts with a one. For example the command achecker(4) % will generate  the matrix%%                  0  1  0  1%                  1  0  1  0  %                  0  1  0  1%                  1  0  1  0C=ones(n,1)*[1:n];A=rem(C+C',2);

⌨️ 快捷键说明

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