필터 지우기
필터 지우기

How to find the CDF of function of a random variable y=|aZ^2+b|, where Z~N(0,var) ?

조회 수: 1 (최근 30일)
Sumedha
Sumedha 2014년 5월 8일
편집: Sumedha 2014년 5월 8일
I want to find the CDF F(y) of following random variable
y=|aZ^2+b|, where Z~N(0,var) such that h=F(y).
Also, I want to do cdfplot(h) and verify whether it is equivalent to CDF of uniform distribution or not. I have tried with the following code:
var1=5;
a=-0.5*((1/var1)-1);
b=-0.5*log(var1);
s=sqrt(var1)*randn(1000,1);
llr=abs(a*s.*s+b);
x=(llr-b)/a;
x1=(-llr-b)/a;
h=zeros(1,length(llr));
for k=1:length(llr)
if (llr(k) >= abs(b))
h(k)=normcdf(sqrt(x(k)),0,var1)-normcdf(-sqrt(x(k)),0,var1);
elseif(llr(k)<abs(b))
h(k)=2*(normcdf(sqrt(x(k)),0,var1)-normcdf(sqrt(x1(k)),0,var1));
end
end
cdfplot(h);
but the cdfplot of h does not match completely with that of uniform distributed random variable. Is there any mistake in finding out the CDF of llr in the given code? Kindly suggest something.
Regards,
Sumedha

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by