How to find the CDF of function of a random variable y=|aZ^2+b|, where Z~N(0,var) ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!