필터 지우기
필터 지우기

How to draw a random number from Cauchy Distribution with a particular mean and standard deviation?

조회 수: 21 (최근 30일)
We can generate a random number from the normal distribution with mean parameter mu and standard deviation parameter sigma using normrnd(mu,sigma). However, how can we generate a random number from the Cauchy distribution using specific mu and sigma;, e.g., mu=0.5 and sigma=0.1?

채택된 답변

Chunru
Chunru 2021년 8월 15일
편집: Chunru 2021년 8월 15일
Using the fact that Cauchy distribution is the Student's t distribution with dof=1.
mu =4e5; sigma = 20;
r = mu+sigma*trnd(1, 100000, 1); % mu, signam: location and scale parameters (not mean and std)
hist(r, 1000);
  댓글 수: 3
Chunru
Chunru 2021년 8월 15일
편집: Chunru 2021년 8월 15일
We are generating Caucht distributed random numbers above with mu and sigma!!! You can change mu and sigma to any value you like.
mu =0.5; sigma = 0.1;
r = mu+sigma*trnd(1, 10, 1)
r = 10×1
0.2176 0.2956 0.7131 0.3013 0.1826 0.1251 0.5845 0.6408 0.4869 0.7205

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

추가 답변 (1개)

Image Analyst
Image Analyst 2021년 8월 15일
  댓글 수: 3

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

카테고리

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