MATLAB Answers

controlled random number generation for 2D lattice

15 views (last 30 days)
Girvani Manoharan
Girvani Manoharan on 29 Jan 2019
Commented: Girvani Manoharan on 30 Jan 2019
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 Comments

jahanzaib ahmad
jahanzaib ahmad on 29 Jan 2019
delete the numbers greater then or less then . this can serve the purpose .
Girvani Manoharan
Girvani Manoharan on 30 Jan 2019
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

Sign in to comment.

Answers (0)

Sign in to answer this question.


Translated by