Create a Slanted Linspace Matrix

1 visualización (últimos 30 días)
Hugo Fortescue
Hugo Fortescue el 20 de En. de 2021
Respondida: Stephen23 el 20 de En. de 2021
Hi All, I am trying to generate noise in an image, and need a matrix of the form:
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
up to 1024x1024. Is there an east way to create this?

Respuesta aceptada

Stephen23
Stephen23 el 20 de En. de 2021
hankel(1:4,4:7)
ans = 4×4
1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7

Más respuestas (1)

Daniel Pollard
Daniel Pollard el 20 de En. de 2021
If you have the signal processing toolbox, the buffer command will do exactly what you want.
If not, something like
x = linspace(xmin, xmax, numx);
matrix = zeros(numx, numx);
for ii = 1:numx
matrix(:, ii) = x + ii - 1;
end
should do the trick.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by