Info

This question is closed. Reopen it to edit or answer.

i want to plot the graph between the probability of false alarm and probability of detection

5 views (last 30 days)
clear; L=3; a=1; N=1000; Ns=3; f1=0.05; v=0.2985; %db2mag gi=1; gl=1; gj=1; w=0; sigm=0; for i=1:L sigma(i)=0.5*(gi)^2; sigm=sigm+sigma(i); end; for n=1:L rs(n)=sigm^2*(Ns-n)/Ns; pl(n)=rs(n); pc(n)=rs(n).*cos(2*pi*f1*n); end ps=0; for l=1:L p(l)=gl*pl(l)*cos(w*l); ps=ps+p(l); end
q=0; for i=1:L for j=1:L if j>i; break
q1(i,j)=0.5*gi*(pc(i-j)+pc(i+j))*gj;
q=q+q1(i,j);
end
end
end %p0=qfunc*(y.*(((y.^2)+sigma)/n).^(-0.5));
for e=1:1:10
y(e)=(qfuncinv(e)).*sqrt((0.5*a)./(N-((qfuncinv(e)).^2))); %lamda
z(e)=(((1+v)*y(e).^2)-(4*ps*v*y(e))+(sigma+q*v))/(N*(v+1)^2);
u1=ps*v/(v+1);
p1(e)=qfunc((y(e)-u1)/sqrt(z(e)^2*(y(e))));
end
plot(p0,p1,'b*'); grid;

Answers (1)

Matt Fig
Matt Fig on 15 Dec 2012
  1. Format your code.
  2. Give a description of what it does and what is wrong
  3. State clearly what you need it to do.
  2 Comments
ahmed
ahmed on 15 Dec 2012
this is m file matlab program and this is the code which i do it and this is amistake in line 46 this code for plot graph between probability of false alarm and probability of detection in cognative radio
Image Analyst
Image Analyst on 15 Dec 2012
Edited: Image Analyst on 15 Dec 2012
But why won't you tell us what the error is???? When I copied and pasted your code into a blank m-file, line 47 was a blank line so I can't even guess what the error is, and I can't even run it because you forgot to list what toolbox was required - the one that has function qfuncinv - so I wasted my time even trying to find out what the error was. Why do you make it hard on us to help you?

Community Treasure Hunt

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

Start Hunting!