I am willing to translate the following Matlab code into Mathematica:
M=10^2;
h=sqrt(2).*(randn(1,M)+1j.*randn(1,M));
n=sqrt(2).*(randn(1,M)+1j.*randn(1,M));
No=var(n);
for z=0:2:20
P=10^(z/10);
a=P.*abs(h).^2/No;
OutageProb= 1 - (igamma[1,1/ a])^2/M;
end
z=0:2:20;
plot(z,OutageProb)
Actually, I would like to know how to implement the above z Loop to get the average outage probability?...However, I translated that code to the following:
M = 10^2
h = Sqrt[2]*RandomReal[1, M] + I*RandomReal[1, M];
n = Sqrt[2]*RandomReal[1, M] + I*RandomReal[1, M];
No = Variance[n];
P = 10^(z/10);
a = P*(Abs[h])^2/No;
OutageProb = 1 - (Gamma[1, 1/a])^2;
LogPlot[OutageProb, {z, 0, 20}, PlotRange -> {10^-4, 1}, Frame -> True]
Unfortunately, my code has been inaccurate and I would like to know what is the wrong in my code?