Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Sumedha
Sumedha le 8 Mai 2014
Modifié(e) : Sumedha le 8 Mai 2014
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

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by