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

3 ビュー (過去 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