Create a random matrix with small gradient

조회 수: 10 (최근 30일)
Jiapeng Zhao
Jiapeng Zhao 2022년 3월 22일
댓글: Torsten 2022년 3월 22일
I'd like to create a special random matrix with a small gradient. That is to say, this matrix contains elements from 0 to 1 and follows a specific distribution (unfortunately my math is bad, and I don't know what distribution it is) so that the difference among an element and its surrouding elements is smaller than a given number (for example 0.1). Could anyone give some hints regarding this problem?
  댓글 수: 1
Torsten
Torsten 2022년 3월 22일
편집: Torsten 2022년 3월 22일
You can't have the elements drawn independently from a distribution and at the same time have difference less than a given number. These two requirements contradict each other.

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2022년 3월 22일
A=rescale(rand(5),0,0.1);
  댓글 수: 1
Torsten
Torsten 2022년 3월 22일
A and rand(5) follow different distributions.

댓글을 달려면 로그인하십시오.

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by