controlled random number generation for 2D lattice

조회 수: 1 (최근 30일)
Girvani Manoharan
Girvani Manoharan 2019년 1월 29일
댓글: Girvani Manoharan 2019년 1월 30일
Hi there,
I want to create a random distribution for a 2D Lattice. But, I want to have the higher values distribution in the vertical middle region. Is there a way to manipulate this using randn() or normrnd() functions in Matlab? Please kindly advise me.
Many thanks,
Vani
  댓글 수: 2
jahanzaib ahmad
jahanzaib ahmad 2019년 1월 29일
delete the numbers greater then or less then . this can serve the purpose .
Girvani Manoharan
Girvani Manoharan 2019년 1월 30일
Thank you. i just written the below code to automate the function.
L=100;
A=zeros(L,L);
for i=1:40
for j=1:100
A(i,j)=1.4*rand;
end
end
for i=41:60
for j=1:100
A(i,j)=1.8*rand;
end
end
for i=61:100
for j=1:100
A(i,j)=1.4*rand;
end
end

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by