필터 지우기
필터 지우기

lognrnd(2.​3,0.8,[500​0,1]), I do not want the value which samller than 1.5? How can I do?

조회 수: 2 (최근 30일)
I want to do something before random values are produced rather than to eliminate them after being produced?
Thank you very much!

답변 (1개)

ankit agrawal
ankit agrawal 2015년 5월 1일
You can do something like this
a=lognrnd(2.3,0.8,[5000,1]);
index=1;
for i=1:length(a);
if a(i)>=1.5;
b(index)=a(i);
index=index+1;
end;
end
Where b has no value less than 1.5
  댓글 수: 1
wang Jerry
wang Jerry 2015년 5월 1일
Thank you very much. But I think it is similar to the way of eliminating them(value less than 1.5) after all the random number being produced. I want to calculate a integral by the Monte Carlo Simulation and variable x follows the lognormal distribution. I want to get the independent samples about x wihch have no value samller than 1.5. Because for the vales less than 1.5, some function are meaningless.

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

Community Treasure Hunt

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

Start Hunting!

Translated by