+ Post New Thread
Results 1 to 2 of 2

19th December 2016, 11:27 #1
 Join Date
 Dec 2016
 Posts
 1
 Helped
 0 / 0
 Points
 16
 Level
 1
what is the (temp) refereed to?
Code:% Array storing theoretical value of Pf for AND logic decison rule PfAND = []; % Array storing simulated value of Pd for AND logic decison rule PdSimulAND = []; % Array storing simulated value of Pf for AND logic decison rule PfSimulAND = []; NormalizedThrptAND = []; for k=1:1:length(tau) % Number of samples in the sensiing duration N = ceil((Fs/T)*tau(k)); PftheoryOR = 0;countsOR = 0;countnOR = 0; PftheoryAND = 0;countsAND = 0;countnAND = 0; for j=1:1:NMonteCarlo % Generating Random Data Data = randint(1,N,4); % Modulated signal mod_sig=pskmod(Data,4); % Finding Epsilon for this frame h = ones(M,1); % AWGN Channel N0 = 1/(10^(AvgSNR/10)); Tyis = zeros(M,1); Tyin = zeros(M,1); % finding the decision statistic for f=1:1:M Noise = sqrt(N0)*((randn(1,N)+sqrt(1)*randn(1,N))/sqrt(2)); Tyis(f) = sum((abs(h(f)*mod_sig + Noise)).^2)/N; Tyin(f) = sum((abs(Noise)).^2)/N; end %OR % Finding the epsiloon for OR decision rule and then finding % the net probability of false alarm Pdi = 1  (0.1)^(1/M); epsilon = zeros(M,1); for f=1:1:M epsilon(f) = ((qfuncinv(Pdi)*sqrt(1+2*abs(h(f))*abs(h(f))*10^(AvgSNR/10)))/(sqrt(N)) + 1 + abs(h(f))*abs(h(f))*10^(AvgSNR/10))/10^(AvgSNR/10); end for f=1:1:M if(Tyin(f)>epsilon(f)) countnOR = countnOR + 1; break; end end for f=1:1:M if(Tyis(f)>epsilon(f)) countsOR = countsOR + 1; break; end end temp = 1; for f=1:1:M temp = temp*(1  qfunc(((epsilon(f)*10^(AvgSNR/10))  1)*sqrt(N))); end PftheoryOR = PftheoryOR + (1  temp);
Last edited by andre_teprom; 19th December 2016 at 11:35. Reason: added CODE tags

19th December 2016, 11:27

20th December 2016, 19:03 #2
 Join Date
 Mar 2005
 Location
 California, USA
 Posts
 3,832
 Helped
 826 / 826
 Points
 19,869
 Level
 34
Re: what is the (temp) refereed to?
We need a much vaguer post. Please don't include any important information like what language you're using, what you're expecting and what the actual problem is.
+ Post New Thread
Please login