필터 지우기
필터 지우기

Create a Slanted Linspace Matrix

조회 수: 3 (최근 30일)
Hugo Fortescue
Hugo Fortescue 2021년 1월 20일
답변: Stephen23 2021년 1월 20일
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?

채택된 답변

Stephen23
Stephen23 2021년 1월 20일
hankel(1:4,4:7)
ans = 4×4
1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7

추가 답변 (1개)

Daniel Pollard
Daniel Pollard 2021년 1월 20일
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.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by