hconsec.m

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

M
14
字号
function A=hconsec(n)
% The command A=hconsec(n) will generate an nxn matrix whose 
% entries in each row are consecutive integers. The first
% entry in each row is the same as the number of the row.
% Thus the first row will be [1, 2, ..., n], the second row 
% will be [2,3, ..., n+1], etc. For example the command 
% hconsec(4) will generate the matrix
%
%                1   2   3   4
%                2   3   4   5
%                3   4   5   6
%                4   5   6   7  
A=hankel([1:n]',[n:2*n-1]);

⌨️ 快捷键说明

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