How to obtain Nakagami random variable from CDF plot?

조회 수: 4 (최근 30일)
shruti
shruti 2012년 9월 13일
zBin = [0:0.01:7];
w = 1;
m=1;
syms zBin;
pzTheory = 2*((m/w)^m)*(zBin.^(2*m-1)).*exp(-(zBin.^2)*m/w)/gamma(m);
F= int(pzTheory,zBin,0,zBin);
F1=abs(F)
ezplot(F, [0, 3]);hold on;
cdfinv=inv(F1);
%ezplot(cdfinv,[0 3]);hold on
%axis([0 3 0.5 -1 2]);
grid on
xlabel('z');
title('Cumulative Distribution function of Nakagami-m' )
I am able to get a cdf curve of Nakagami distribution,now how do i get a random variable from this plot. I need to use this random variable with BPSK. Please Help... Thanks in advance

채택된 답변

Tom Lane
Tom Lane 2012년 9월 13일
The inv function computes a matrix inverse. If you want to invert the function using the Symbolic Toolbox, something like this might work:
solve('p = 1 - exp(-zBin^2)','zBin')
a = sym('(-log(1 - p))^(1/2)') % got this from result of previous
b = subs(a,'p',rand(500,1));
If you have the Statistics Toolbox, that supports the Nakagama distribution directly. For example:
c = random('naka',1,1,1000,1); % parameters (1,1), size 1000-by-1
  댓글 수: 1
shruti
shruti 2012년 9월 13일
It worked!! I am so thankful to you!
Regards, Shruti

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by