% colon 1D matrix (start : step size : end) The step size is 1, which can be omitted. b = 1:1:10; % 1,2,...10 b = 1:10; % Equivalent to above
1 2 3 4
% function generation % linspace(start, end, number of elements), Arithmetic generates a 1D matrix with the specified number of elements. % If the number of elements is omitted, the default is 100. c = linspace(0, 10, 5);
1 2 3 4 5 6 7
% function generation % special matrix e = eye(4); % eye(dimension) unit array z = zeros(1, 4); % zeros(dimension) all 0 o = ones(4, 1); % ones(dimension) all 1 r = rand(4); % rand(dimension) 0 to 1 distributed random array rn = randn(4); % randn(dimension) 0 mean, Gaussian random array