Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
cognitive radio

Subject: cognitive radio

From: nancy

Date: 8 Aug, 2008 06:04:09

Message: 1 of 46

hello
i'm working on spectrum sensing techniques in cognitive
radio...it is an emerging topic and we don't find any codes
or any help for it. i'm also facing problems as i have to
start fresh...if anyone has any codes related to it could u
please send me some too...it would be the greatest help for
me in doing my project...
thank u in advance
nancy

Subject: cognitive radio

From: Guido Gioberto

Date: 19 Aug, 2008 23:16:02

Message: 2 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message
<g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any
codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could
u
> please send me some too...it would be the greatest help
for
> me in doing my project...
> thank u in advance
> nancy
 
hi nancy,

I am developing an University project about CR. I know
OSSIE (http://ossie.wireless.vt.edu/trac/wiki), but I don't
know if it can help you. Did you find any interesting
source code about CR?

Subject: cognitive radio

From: nancy

Date: 21 Aug, 2008 04:45:02

Message: 3 of 46

hi Guido
thank you so much for the reply. i looked at the link you
gave but found nothing related to spectrum sensing :( . i
have not got any code related to it yet :(. however i am now
trying to simulate the energy detection technique using
MATLAB. it is still not finished coz i'm new to MATLAB and
having problem with coding. i am stuck with the probability
of false alarm.actually i'm trying to follow the IEEE paper
"Secure cooperative sensing techniques for cognitive radio
systems" by Bhargava et. al. i would be grateful if any
MATLAB code regarding the sensing technique is given.
thanx a lot....
nancy

"Guido Gioberto" <likkho@libero.it> wrote in message
<g8fk7i$cto$1@fred.mathworks.com>...
> "nancy " <nancy.gonzalvis@gmail.com> wrote in message
> <g7gnkp$qhj$1@fred.mathworks.com>...
> > hello
> > i'm working on spectrum sensing techniques in cognitive
> > radio...it is an emerging topic and we don't find any
> codes
> > or any help for it. i'm also facing problems as i have to
> > start fresh...if anyone has any codes related to it could
> u
> > please send me some too...it would be the greatest help
> for
> > me in doing my project...
> > thank u in advance
> > nancy
>
> hi nancy,
>
> I am developing an University project about CR. I know
> OSSIE (http://ossie.wireless.vt.edu/trac/wiki), but I don't
> know if it can help you. Did you find any interesting
> source code about CR?
>

Subject: cognitive radio

From: nancy

Date: 5 Sep, 2008 10:36:01

Message: 4 of 46

hello

as i posted the spectrum sensing problem earlier i wanted to
know about the probability of false alarm. i worked out for
the probability of detection and got the curve as given by
the paper of Bhargava et. al. i calculated the probability
of detection by first finding the individual detection using
energy detection and then dividing the number of times the
detection is produced with the number of iteration. now i
want to find the probability of false alarm but am not
getting any idea to implement it in matlab. anybody has any
idea to calculate the probability of false alarm. please
help me...
thank u

Subject: cognitive radio

From: rizwan

Date: 15 Oct, 2008 17:25:05

Message: 5 of 46

Hi Dear i hv false alarm code in matlab.....u cn get it from me by mailing on razi_sial@hotmail.com.........i also need little bit help from u about cognitive radios spectrum sensing..

Subject: cognitive radio

From: chen ximei

Date: 20 Oct, 2008 05:39:02

Message: 6 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g9r22h$h0g$1@fred.mathworks.com>...
> hello
> I also do the research about cognitive radio.
> as i posted the spectrum sensing problem earlier i wanted to
> know about the probability of false alarm. i worked out for
> the probability of detection and got the curve as given by
> the paper of Bhargava et. al. i calculated the probability
> of detection by first finding the individual detection using
> energy detection and then dividing the number of times the
> detection is produced with the number of iteration. now i
> want to find the probability of false alarm but am not
> getting any idea to implement it in matlab. anybody has any
> idea to calculate the probability of false alarm. please
> help me...
> thank u

Subject: cognitive radio

From: chen ximei

Date: 20 Oct, 2008 05:46:02

Message: 7 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g9r22h$h0g$1@fred.mathworks.com>...
> hello
  I have some ploblem in simulating the spectrum sensing and spectrum sharing in cognitive. Can you sent me the associated source code, because I simulate first time. Thanks!

Subject: cognitive radio

From: gmt mathew

Date: 12 Jan, 2009 04:50:03

Message: 8 of 46

Need some help in simulating spectrum sensing in CR. Would you share the code with me. Thanks in advance...


"chen ximei" <sammy.cxm@gmail.com> wrote in message <gdh5uq$cmg$1@fred.mathworks.com>...
> "nancy " <nancy.gonzalvis@gmail.com> wrote in message <g9r22h$h0g$1@fred.mathworks.com>...
> > hello
> I have some ploblem in simulating the spectrum sensing and spectrum sharing in cognitive. Can you sent me the associated source code, because I simulate first time. Thanks!

Subject: cognitive radio

From: Mirage Bhatti

Date: 12 Feb, 2009 23:39:01

Message: 9 of 46

Hi nancy,
I am also working on Spectrum Sensing in Cognitive Radios, and I am just begining to work in MATLAB. Can you kindly give me some code to start with. I will be extremely grateful. Thanking in advance.

Farrukh

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could u
> please send me some too...it would be the greatest help for
> me in doing my project...
> thank u in advance
> nancy

Subject: cognitive radio

From: sapna sharad

Date: 13 Feb, 2009 05:30:03

Message: 10 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could u
> please send me some too...it would be the greatest help for
> me in doing my project...
> thank u in advance
> nancy
hi nancy
i am doing a project on CR... i am implementing th IEEE paper "sensing throughput for cognitive radio networks".. am new to matlab and i have to find probability of detection to find throughput.. can you please send me the codes related to probability of detection and probability of false alarm.. am not able to get the proper curve..
thank you..

Subject: cognitive radio

From: Soyoung LEe

Date: 23 Feb, 2009 07:56:05

Message: 11 of 46

hi nancy
I am soyuong that attend master's course in the Korea.
i am doing a project on CR.
i am implementing the Wi-opt paper "Cooperative spectrum Sensing technique for Cognitive Radio Using Channel coding"..
I am looking for single detection code using energy detector and cooperative sensing code.
If you send to me related Matlab codes, it would be the greatest help for
me in doing my project :D
thank you..
"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could u
> please send me some too...it would be the greatest help for
> me in doing my project...
> thank u in advance
> nancy

Subject: cognitive radio

From: talhazahir@gmail.com

Date: 23 Feb, 2009 15:19:49

Message: 12 of 46

hi
i am doing the same work.i have to implement energy detection unsing
chi squar random variables. can anyone help me
plzzzzzzzzzzzzzzzzz..ill be really thankfull to you ...

Subject: cognitive radio

From: mary

Date: 7 Apr, 2009 02:34:02

Message: 13 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could u
> please send me some too...it would be the greatest help for
> me in doing my project...
> thank u in advance
> nancy
Hello,
I am also working on CR,I am a freash man in the field.So I have some difficulty in simulation.Do you have some matlab code about sensing?Would you please send me some codes.I really need it very much.I am grateful to you.Thank you very much.
Mary

Subject: cognitive radio

From: kk muthu

Date: 15 Jul, 2009 05:55:03

Message: 14 of 46

hi nancy am also doing project in cognitive radio if possible please give code for it

Subject: cognitive radio

From: Alicia Cheng

Date: 15 Jul, 2009 17:15:20

Message: 15 of 46

"kk muthu" <kaykay2k2@yahoo.com> wrote in message <h3jqvn$j4c$1@fred.mathworks.com>...
> hi nancy am also doing project in cognitive radio if possible please give code for it
Hi dear,I am working on Energy detection on spectrum sensing of cognitive radio.
Could anyone have the code also send me a copy? huialicia@msn.com
I really need it for my course project which is due in a month.
I am really bad at programming!!!!Thanks!

Subject: cognitive radio

From: Brice

Date: 8 Sep, 2009 12:17:05

Message: 16 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g9r22h$h0g$1@fred.mathworks.com>...
> hello
>
> as i posted the spectrum sensing problem earlier i wanted to
> know about the probability of false alarm. i worked out for
> the probability of detection and got the curve as given by
> the paper of Bhargava et. al. i calculated the probability
> of detection by first finding the individual detection using
> energy detection and then dividing the number of times the
> detection is produced with the number of iteration. now i
> want to find the probability of false alarm but am not
> getting any idea to implement it in matlab. anybody has any
> idea to calculate the probability of false alarm. please
> help me...
> thank u


Hi nancy,
I am also working on Spectrum Sensing with energy detector and false alarm probability, and I am just begining to work in MATLAB. Can you kindly give me some code to start with. I will be extremely grateful. Thanking in advance.

Brice

Subject: cognitive radio

From: ehab elshaer

Date: 22 Oct, 2009 13:05:14

Message: 17 of 46

hi
if anyone has any codes on spectrum sensing for matlab plz send it because i cant find anything <ehabelc@hotmail.com>

Subject: cognitive radio

From: Johnas

Date: 27 Oct, 2009 22:00:19

Message: 18 of 46

Hi rizwan, I saw your post and I am doing spectrum sensing in cognitive radio. Is it possible I get the false alram code from you? I appreciate your help.

"rizwan " <razi_sial@hotmail.com> wrote in message <gd591h$jh$1@fred.mathworks.com>...
> Hi Dear i hv false alarm code in matlab.....u cn get it from me by mailing on razi_sial@hotmail.com.........i also need little bit help from u about cognitive radios spectrum sensing..

Subject: cognitive radio

From: Luca

Date: 7 Dec, 2009 15:10:06

Message: 19 of 46

Plz can you send me matlab code about Radio Cognitive?
Thanks

Subject: cognitive radio

From: Md. Rakib

Date: 16 Jan, 2010 12:21:02

Message: 20 of 46

Hi all, can anyone send me any matlab code for cognitive radio simulation? Please help.

Subject: cognitive radio

From: khalil ajmi

Date: 7 Mar, 2010 10:37:07

Message: 21 of 46

hello every one i am working in matlab to simulate the spectrum sensing in siso system using the energy detection technique.i wonder if anyone can help me about this?
thanks in advance .

Subject: cognitive radio

From: Vivi Sera

Date: 3 May, 2010 14:09:06

Message: 22 of 46

Hello everyone,

I am doing a term project in spectrum sensing as well, probably focus on cooperative schemes, but will start with the conventional one, such as energy detection, matched filter, etc etc. If any of you have some good scripts for me to start off, would it be okay for you to share with me, please? I really appreciate it!!

Vivi

Subject: cognitive radio

From: Vivi Sera

Date: 3 May, 2010 14:12:06

Message: 23 of 46

I am doing a term project in spectrum sensing as well, probably focus on cooperative schemes, but will start with the conventional one, such as energy detection, matched filter, etc etc. If any of you have some good scripts for me to start off, would it be okay for you to share with me, please? I really appreciate it!!

Vivi

Subject: cognitive radio

From: sesham srinu

Date: 8 May, 2010 16:51:05

Message: 24 of 46

"Vivi Sera" <vivi.seraphic@gmail.com> wrote in message <hrmljm$htd$1@fred.mathworks.com>...
> I am doing a term project in spectrum sensing as well, probably focus on cooperative schemes, but will start with the conventional one, such as energy detection, matched filter, etc etc. If any of you have some good scripts for me to start off, would it be okay for you to share with me, please? I really appreciate it!
hai iam sesham srinu from university of hyderabad,india
%Entropy estimation of a stochastic signal for primary user detection for the matched filter case


clear all;clc;

%**************************************Input parameters**********************************************************************************
  
 b = [ 1 0 0 1 1]; % Input bit stream

N=[16 32 64];

for j=1:length(N)
snr_db=0:1:20;
g=length(snr_db);
%*************************************BPSK signal generation, Matched filtering and Sampling********************************************
for z=1:length(snr_db)
        
  [signal]=bpsk(b); %BPSK signal generation
 signal_fad=b_fad(signal); %fading
 [s_matched signal_noise noise]=match(signal_fad,snr_db(z)); % matched filtered output of Qpsk signal
  
 
%************************************Entropy anlaysis after matched filter output is sampled********************************************
  
 
 L=N(j); %No.of bins
 
 s=s_matched(1:N(j)); % N no.of samples Sampled output of matched filter
  
 x=[ ];
 x=s(1:N(j)); %block of N samples of matched filter to make decision
    
 noise=noise(1:N(j));
 
 K=4;
 sq=sum(x.^2)/N(j);
 sigma = sqrt(sum(x.^2)/N(j));
  %**********************************checking for chebyeshev inequality*******************************************************************
  count=0;
 for i=1:N(j)
      if(abs((x(i)-mean(x)))>(K*sigma))
          count=count+1;
      
        else
          count=count;
      end
 end
 
 if ((count/N(j))<= (1/(K^2)))
      
   %display('Design value of K is correct ');
     
 else
    %display('Design value of K is incorrect and try for another value');
     
 end

 % %***********************************Histogram of x**************************************************************************************
  v1=(2*K*sigma)/(L); % Width of each bin
 v=-K*sigma:v1 :K*sigma; % a vector specifying the centres of bins from where to start and stop.

 %***********************************Checking for no.of values of x fallong inside the kth bin********************************************
 
pa11=0;
 pa01=0; y1=0;e(z)=0;
for k=1:L;
       
number_samples=0;

    
               
    lk(k)=v(k)-(v1/2);
    lkplus1(k)=v(k)+(v1/2);
    
for i=1:N(j)
  if((lk(k)<x(i))& (x(i)<lkplus1(k)))
number_samples=number_samples+1;
else
 number_samples=number_samples+eps;
  end
    end
                              
nk=number_samples;

y1=y1+number_samples;
%----------------------------------------Entropy caculation------------

 if(nk~=0)
     nk=nk;
 else
   nk=nk+eps;
    
 end
    p(k) = -((nk/N(j))*log2(nk/N(j)));
  e(z)= e(z)+p(k) ; %Entropy estimate

 
 
    
  %********************************************computing pk(a)********************************************************************************
 a1=snr_db(z);
 
 a0=0;

  pk1=0;pk0=0; M=2; u(1)=1;u(2)=-1;
 for m=1:M
    h1(m)=0;h2(m)=0;h3(m)=0;h4(m)=0;
    
    h1(m)=(lk(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
    h2(m)=(lkplus1(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
    h3(m)=(lk(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
    h4(m)= (lkplus1(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
    
    
       
 pk1=pk1+[[qfunc(h1(m))]-[qfunc(h2(m))]];
 pk0=pk0+[[qfunc(h3(m))]-[qfunc(h4(m))]];
    
 end
 
  pka1= (1/M)*pk1+eps;
  pka0= (1/M)*pk0+eps;
 
 %*********************************************computing log-likelihood ratio***************************************************************

 pa11=pa11+(nk/N(j))*[log2(pka1)-log2(pka0)];
     
    
end

 le(z)=pa11;%Log-likelihood ratio of entropy
end

e1((j+(j-1)*20):j*21)=e;
le1((j+(j-1)*20):j*21)=le;
end



plot(snr_db,e1(1:21),'-b*',snr_db,e1(22:42),'-ro',snr_db,e1(43:63),'-g.');
 xlabel('SNR in db');
 ylabel('Entropy');
 title('Normal entropy');
  h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);

 figure
 plot(snr_db,le1(1:21),'-b*',snr_db,le1(22:42),'-ro',snr_db,le1(43:63),'-g.');
 xlabel('SNR in db');
 ylabel('Log-likelihood Entropy');
 title('log-likelihood entropy')
 h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);


 

Subject: cognitive radio

From: sesham srinu

Date: 8 May, 2010 16:58:05

Message: 25 of 46

"Mirage Bhatti" <farrukh59th@yahoo.com> wrote in message <gn2bul$lb2$1@fred.mathworks.com>...
> Hi nancy,
> I am also working on Spectrum Sensing in Cognitive Radios, and I am just begining to work in MATLAB. Can you kindly give me some code to start with. I will be extremely grateful. Thanking in advance.
>
> Farrukh
>
> "nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> > hello
> > i'm working on spectrum sensing techniques in cognitive
> > radio...it is an emerging topic and we don't find any codes
> > or any help for it. i'm also facing problems as i have to
> > start fresh...if anyone has any codes related to it could u
> > please send me some too...it would be the greatest help for
> > me in doing my project...
> > thank u in advance
> > nancy
hay i already put matlab code in news group see once
iam sesham srinu from university of hyderabad.
its matched filtering

Subject: cognitive radio

From: sesham srinu

Date: 8 May, 2010 17:01:07

Message: 26 of 46

"Luca " <c41n0@live.it> wrote in message <hfj5se$3of$1@fred.mathworks.com>...
> Plz can you send me matlab code about Radio Cognitive?
> Thanks
hai see the link
http://www.mathworks.com/matlabcentral/newsreader/view_thread/173978
if you want full details send me e mail

Subject: cognitive radio

From: samee Rehman

Date: 2 Jun, 2010 15:16:06

Message: 27 of 46

"sapna sharad" <sapna_sila@ymail.com> wrote in message <gn30gr$46a$1@fred.mathworks.com>...
> "nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> > hello
> > i'm working on spectrum sensing techniques in cognitive
> > radio...it is an emerging topic and we don't find any codes
> > or any help for it. i'm also facing problems as i have to
> > start fresh...if anyone has any codes related to it could u
> > please send me some too...it would be the greatest help for
> > me in doing my project...
> > thank u in advance
> > nancy
> hi nancy
> i am doing a project on CR... i am implementing th IEEE paper "sensing throughput for cognitive radio networks".. am new to matlab and i have to find probability of detection to find throughput.. can you please send me the codes related to probability of detection and probability of false alarm.. am not able to get the proper curve..
> thank you..


Hello, i am also working on the ieee paper "sensing throughput for cognitive radio networks"
can u plz also send me the code related to probability of detection and probability of false alarm....thanx in advance

Subject: cognitive radio

From: her linda

Date: 16 Jul, 2010 13:14:06

Message: 28 of 46

hello everyone,
i'm a student who do the research with cognitive radio too
but I bumped into a big problem
I am a beginner with matlab
and i am doing with collision detection in CR
does anyone have some code with CR
even the spectrum sensing program may help me
Plzzzzzzzzzzzzzzzzzz!!!thank you all

Subject: cognitive radio

From: Steven Lord

Date: 16 Jul, 2010 13:31:36

Message: 29 of 46


"her linda" <f4rabbit@yahoo.com.tw> wrote in message
news:i1pluu$1b8$1@fred.mathworks.com...
> hello everyone,
> i'm a student who do the research with cognitive radio too
> but I bumped into a big problem
> I am a beginner with matlab
> and i am doing with collision detection in CR
> does anyone have some code with CR
> even the spectrum sensing program may help me
> Plzzzzzzzzzzzzzzzzzz!!!thank you all

That's not how this newsgroup generally works.

When you ask for help like this, the expectation is that you show what
YOU'VE done to try to solve the problem first. We were all (well, except
for Cleve, but he's a special case) beginners with MATLAB once -- many of us
got better :) If you show what you've tried and ask a SPECIFIC question
about where you need help, you'll likely receive at least a little help.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: cognitive radio

From: mike mekkanen

Date: 8 Oct, 2010 11:50:05

Message: 30 of 46

"Steven Lord" <slord@mathworks.com> wrote in message <i1pmvo$72f$1@fred.mathworks.com>...
>
> "her linda" <f4rabbit@yahoo.com.tw> wrote in message
> news:i1pluu$1b8$1@fred.mathworks.com...
> > hello everyone,
> > i'm a student who do the research with cognitive radio too
> > but I bumped into a big problem
> > I am a beginner with matlab
> > and i am doing with collision detection in CR
> > does anyone have some code with CR
> > even the spectrum sensing program may help me
> > Plzzzzzzzzzzzzzzzzzz!!!thank you all
>
> That's not how this newsgroup generally works.
>
> When you ask for help like this, the expectation is that you show what
> YOU'VE done to try to solve the problem first. We were all (well, except
> for Cleve, but he's a special case) beginners with MATLAB once -- many of us
> got better :) If you show what you've tried and ask a SPECIFIC question
> about where you need help, you'll likely receive at least a little help.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
>

Subject: cognitive radio

From: shamser

Date: 14 Nov, 2010 09:51:03

Message: 31 of 46

"mike mekkanen" <p87591@uwasa.fi> wrote in message <i8n0hd$m8o$1@fred.mathworks.com>...
> "Steven Lord" <slord@mathworks.com> wrote in message <i1pmvo$72f$1@fred.mathworks.com>...
> >
> > "her linda" <f4rabbit@yahoo.com.tw> wrote in message
> > news:i1pluu$1b8$1@fred.mathworks.com...
> > > hello everyone,
> > > i'm a student who do the research with cognitive radio too
> > > but I bumped into a big problem
> > > I am a beginner with matlab
> > > and i am doing with collision detection in CR
> > > does anyone have some code with CR
> > > even the spectrum sensing program may help me
> > > Plzzzzzzzzzzzzzzzzzz!!!thank you all
> >
> > That's not how this newsgroup generally works.
> >
> > When you ask for help like this, the expectation is that you show what
> > YOU'VE done to try to solve the problem first. We were all (well, except
> > for Cleve, but he's a special case) beginners with MATLAB once -- many of us
> > got better :) If you show what you've tried and ask a SPECIFIC question
> > about where you need help, you'll likely receive at least a little help.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
> >

Subject: cognitive radio

From: shamser

Date: 14 Nov, 2010 09:52:03

Message: 32 of 46

"mike mekkanen" <p87591@uwasa.fi> wrote in message <i8n0hd$m8o$1@fred.mathworks.com>...
> "Steven Lord" <slord@mathworks.com> wrote in message <i1pmvo$72f$1@fred.mathworks.com>...
> >
> > "her linda" <f4rabbit@yahoo.com.tw> wrote in message
> > news:i1pluu$1b8$1@fred.mathworks.com...
> > > hello everyone,
> > > i'm a student who do the research with cognitive radio too
> > > but I bumped into a big problem
> > > I am a beginner with matlab
> > > and i am doing with collision detection in CR
> > > does anyone have some code with CR
> > > even the spectrum sensing program may help me
> > > Plzzzzzzzzzzzzzzzzzz!!!thank you all
> >
> > That's not how this newsgroup generally works.
> >
> > When you ask for help like this, the expectation is that you show what
> > YOU'VE done to try to solve the problem first. We were all (well, except
> > for Cleve, but he's a special case) beginners with MATLAB once -- many of us
> > got better :) If you show what you've tried and ask a SPECIFIC question
> > about where you need help, you'll likely receive at least a little help.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
> >

Subject: cognitive radio

From: shamser

Date: 14 Nov, 2010 10:05:04

Message: 33 of 46

"shamser " <shimul26@yahoo.com> wrote in message <ibobg3$sd5$1@fred.mathworks.com>...
> "mike mekkanen" <p87591@uwasa.fi> wrote in message <i8n0hd$m8o$1@fred.mathworks.com>...
> > "Steven Lord" <slord@mathworks.com> wrote in message <i1pmvo$72f$1@fred.mathworks.com>...
> > >
> > > "her linda" <f4rabbit@yahoo.com.tw> wrote in message
> > > news:i1pluu$1b8$1@fred.mathworks.com...
> > > > hello everyone,
> > > > i'm a student who do the research with cognitive radio too
> > > > but I bumped into a big problem
> > > > I am a beginner with matlab
> > > > and i am doing with collision detection in CR
> > > > does anyone have some code with CR
> > > > even the spectrum sensing program may help me
> > > > Plzzzzzzzzzzzzzzzzzz!!!thank you all
> > >
> > > That's not how this newsgroup generally works.
> > >
> > > When you ask for help like this, the expectation is that you show what
> > > YOU'VE done to try to solve the problem first. We were all (well, except
> > > for Cleve, but he's a special case) beginners with MATLAB once -- many of us
> > > got better :) If you show what you've tried and ask a SPECIFIC question
> > > about where you need help, you'll likely receive at least a little help.
> > >
> > > --
> > > Steve Lord
> > > slord@mathworks.com
> > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > > To contact Technical Support use the Contact Us link on
> > > http://www.mathworks.com
> > > mail msashimul@gmail.com. He will provide you the solution within one day.

Subject: cognitive radio

From: shamser

Date: 14 Nov, 2010 10:08:03

Message: 34 of 46

"shamser " <shimul26@yahoo.com> wrote in message <ibobg3$sd5$1@fred.mathworks.com>...
> "mike mekkanen" <p87591@uwasa.fi> wrote in message <i8n0hd$m8o$1@fred.mathworks.com>...
> > "Steven Lord" <slord@mathworks.com> wrote in message <i1pmvo$72f$1@fred.mathworks.com>...
> > >
> > > "her linda" <f4rabbit@yahoo.com.tw> wrote in message
> > > news:i1pluu$1b8$1@fred.mathworks.com...
> > > > hello everyone,
> > > > i'm a student who do the research with cognitive radio too
> > > > but I bumped into a big problem
> > > > I am a beginner with matlab
> > > > and i am doing with collision detection in CR
> > > > does anyone have some code with CR
> > > > even the spectrum sensing program may help me
> > > > Plzzzzzzzzzzzzzzzzzz!!!thank you all
> > >
> > > That's not how this newsgroup generally works.
> > >
> > > When you ask for help like this, the expectation is that you show what
> > > YOU'VE done to try to solve the problem first. We were all (well, except
> > > for Cleve, but he's a special case) beginners with MATLAB once -- many of us
> > > got better :) If you show what you've tried and ask a SPECIFIC question
> > > about where you need help, you'll likely receive at least a little help.
> > >
> > > --
> > > Steve Lord
> > > slord@mathworks.com
> > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > > To contact Technical Support use the Contact Us link on
> > > http://www.mathworks.com
> > > mail msashimul@gmail.com. He will provide you the solution with in one day..

Subject: cognitive radio

From: ravi sharan

Date: 25 Nov, 2010 15:39:04

Message: 35 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could u
> please send me some too...it would be the greatest help for
> me in doing my project...
> thank u in advance
> nancy
well nancy could u please explain me wat actually is a cognitive radio?
i am an engineering student trying to do some extraordinary project for my academic schedule. so please explain me what is a cognitive radio

Subject: cognitive radio

From: Walter Roberson

Date: 25 Nov, 2010 15:52:08

Message: 36 of 46

On 25/11/10 9:39 AM, ravi sharan wrote:

> well nancy could u please explain me wat actually is a cognitive radio?

Did you try google?

Subject: cognitive radio

From: amber

Date: 10 Feb, 2011 05:58:03

Message: 37 of 46

"Md. Rakib" wrote in message <hisave$27m$1@fred.mathworks.com>...
> Hi all, can anyone send me any matlab code for cognitive radio simulation? Please help.
hi
can u share the matlab code to begin with on cognitive radio, if any.
thanks in advance
amber

Subject: cognitive radio

From: Sindiso Nleya

Date: 25 May, 2011 14:59:21

Message: 38 of 46

i am new to matlab and will need to simulate spectrum sensing can anyone please help with the any code i can start with.
Rabile"

nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could u
> please send me some too...it would be the greatest help for
> me in doing my project...
> thank u in advance
> nancy

Subject: cognitive radio

From: krithi vengat

Date: 8 Jan, 2012 02:20:08

Message: 39 of 46

HI
I get ur MATLAB coding for my project but it shows error in signal generation of BPSK. Since I'm new to MATLAB I'm unable to recover, can u suggest me some idea. And also I need MATLAB coding for Co-operative spectrum sensing for probability of false alarm detection.
I've some code pl go thro' it and tel wat correction i need to do.

clear all;
close all;
clc


u=1000;%time bandwidth factor
N=2*u;%samples
a=2;%path loss exponent
C=2;%constant losses
Crs=10; %Number of cognitive radio users
PdAnd=0;
%----------Pfa------------%
Pf=0.01:0.01:1;
Pfa=Pf.^2;
%---------signal-----%
t=1:N;
s1 = cos(pi*t);
% s1power=var(s1);


%-------- SNR ----------%
% Snrdb=-15:1:15;
Snrdb=15;
Snreal=power(10,Snrdb/10);%Linear Snr

% while Snrdb<15
for i=1:length(Pfa)
lamda(i)=gammaincinv(1-Pfa(i),u)*2; %theshold
% lamdadB=10*log10(lamda);


%---------Local spectrum sensing---------%

for j=1:Crs %for each node
detect=0;
% d(j)=7+1.1*rand(); %random distanse
d=7:0.1:8;
PL=C*(d(j)^-a); %path loss

for sim=1:10%Monte Carlo Simulation for 100 noise realisation

%-------------AWGN channel--------------------%
noise = randn(1,N); %Noise production with zero mean and s^2 var
noise_power = mean(noise.^2); %noise average power
amp = sqrt(noise.^2*Snreal);
s1=amp.*s1./abs(s1);
% SNRdB_Sample=10*log10(s1.^2./(noise.^2));
Rec_signal=s1+noise;%received signal
localSNR(j)=mean(abs(s1).^2)*PL/noise_power;%local snr
Pdth(j,i)=marcumq(sqrt(2*localSNR(j)),sqrt(lamda(i )),u);%Pd for j node

%Computation of Test statistic for energy detection
Sum=abs(Rec_signal).^2*PL;
Test(j,sim)=sum(Sum);
if (Test(j,sim)>lamda(i))
detect=detect+1;
end

end %END Monte Carlo

Pdsim(j)=detect/sim; %Pd of simulation for the j-th CRuser


end
PdAND(i)=prod(Pdsim);
PdOR(i)=1-prod(1-Pdsim);

end


PdAND5=(Pdth(5,:)).^5;
Pmd5=1-PdAND5;
PdANDth=(Pdth(Crs,:)).^Crs;
PmdANDth=1-PdANDth; %Probability of miss detection
Pmdsim=1-PdAND;
figure(1);
plot(Pfa,Pmdsim,'r-*',Pfa,PmdANDth,'k-o',Pfa,Pmd5,'g-*');
title('Complementary ROC of Cooperative sensing with AND rule under AWGN');
grid on
axis([0.0001,1,0.0001,1]);
xlabel('Probability of False alarm (Pfa)');
ylabel('Probability of Missed Detection (Pmd)');
legend('Simulation','Theory n=10','Theory n=5');

Expecting reply with thanks

"sesham srinu" <seshamsrinu83@gmail.com> wrote in message <hs44pp$dou$1@fred.mathworks.com>...
> "Vivi Sera" <vivi.seraphic@gmail.com> wrote in message <hrmljm$htd$1@fred.mathworks.com>...
> > I am doing a term project in spectrum sensing as well, probably focus on cooperative schemes, but will start with the conventional one, such as energy detection, matched filter, etc etc. If any of you have some good scripts for me to start off, would it be okay for you to share with me, please? I really appreciate it!
> hai iam sesham srinu from university of hyderabad,india
> %Entropy estimation of a stochastic signal for primary user detection for the matched filter case
>
>
> clear all;clc;
>
> %**************************************Input parameters**********************************************************************************
>
> b = [ 1 0 0 1 1]; % Input bit stream
>
> N=[16 32 64];
>
> for j=1:length(N)
> snr_db=0:1:20;
> g=length(snr_db);
> %*************************************BPSK signal generation, Matched filtering and Sampling********************************************
> for z=1:length(snr_db)
>
> [signal]=bpsk(b); %BPSK signal generation
> signal_fad=b_fad(signal); %fading
> [s_matched signal_noise noise]=match(signal_fad,snr_db(z)); % matched filtered output of Qpsk signal
>
>
> %************************************Entropy anlaysis after matched filter output is sampled********************************************
>
>
> L=N(j); %No.of bins
>
> s=s_matched(1:N(j)); % N no.of samples Sampled output of matched filter
>
> x=[ ];
> x=s(1:N(j)); %block of N samples of matched filter to make decision
>
> noise=noise(1:N(j));
>
> K=4;
> sq=sum(x.^2)/N(j);
> sigma = sqrt(sum(x.^2)/N(j));
> %**********************************checking for chebyeshev inequality*******************************************************************
> count=0;
> for i=1:N(j)
> if(abs((x(i)-mean(x)))>(K*sigma))
> count=count+1;
>
> else
> count=count;
> end
> end
>
> if ((count/N(j))<= (1/(K^2)))
>
> %display('Design value of K is correct ');
>
> else
> %display('Design value of K is incorrect and try for another value');
>
> end
>
> % %***********************************Histogram of x**************************************************************************************
> v1=(2*K*sigma)/(L); % Width of each bin
> v=-K*sigma:v1 :K*sigma; % a vector specifying the centres of bins from where to start and stop.
>
> %***********************************Checking for no.of values of x fallong inside the kth bin********************************************
>
> pa11=0;
> pa01=0; y1=0;e(z)=0;
> for k=1:L;
>
> number_samples=0;
>
>
>
> lk(k)=v(k)-(v1/2);
> lkplus1(k)=v(k)+(v1/2);
>
> for i=1:N(j)
> if((lk(k)<x(i))& (x(i)<lkplus1(k)))
> number_samples=number_samples+1;
> else
> number_samples=number_samples+eps;
> end
> end
>
> nk=number_samples;
>
> y1=y1+number_samples;
> %----------------------------------------Entropy caculation------------
>
> if(nk~=0)
> nk=nk;
> else
> nk=nk+eps;
>
> end
> p(k) = -((nk/N(j))*log2(nk/N(j)));
> e(z)= e(z)+p(k) ; %Entropy estimate
>
>
>
>
> %********************************************computing pk(a)********************************************************************************
> a1=snr_db(z);
>
> a0=0;
>
> pk1=0;pk0=0; M=2; u(1)=1;u(2)=-1;
> for m=1:M
> h1(m)=0;h2(m)=0;h3(m)=0;h4(m)=0;
>
> h1(m)=(lk(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
> h2(m)=(lkplus1(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
> h3(m)=(lk(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
> h4(m)= (lkplus1(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
>
>
>
> pk1=pk1+[[qfunc(h1(m))]-[qfunc(h2(m))]];
> pk0=pk0+[[qfunc(h3(m))]-[qfunc(h4(m))]];
>
> end
>
> pka1= (1/M)*pk1+eps;
> pka0= (1/M)*pk0+eps;
>
> %*********************************************computing log-likelihood ratio***************************************************************
>
> pa11=pa11+(nk/N(j))*[log2(pka1)-log2(pka0)];
>
>
> end
>
> le(z)=pa11;%Log-likelihood ratio of entropy
> end
>
> e1((j+(j-1)*20):j*21)=e;
> le1((j+(j-1)*20):j*21)=le;
> end
>
>
>
> plot(snr_db,e1(1:21),'-b*',snr_db,e1(22:42),'-ro',snr_db,e1(43:63),'-g.');
> xlabel('SNR in db');
> ylabel('Entropy');
> title('Normal entropy');
> h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);
>
> figure
> plot(snr_db,le1(1:21),'-b*',snr_db,le1(22:42),'-ro',snr_db,le1(43:63),'-g.');
> xlabel('SNR in db');
> ylabel('Log-likelihood Entropy');
> title('log-likelihood entropy')
> h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);
>
>
>

Subject: cognitive radio

From: krithi vengat

Date: 8 Jan, 2012 02:21:08

Message: 40 of 46

HI
I get ur MATLAB coding for my project but it shows error in signal generation of BPSK. Since I'm new to MATLAB I'm unable to recover, can u suggest me some idea. And also I need MATLAB coding for Co-operative spectrum sensing for probability of false alarm detection.
I've some code pl go thro' it and tel wat correction i need to do.

clear all;
close all;
clc


u=1000;%time bandwidth factor
N=2*u;%samples
a=2;%path loss exponent
C=2;%constant losses
Crs=10; %Number of cognitive radio users
PdAnd=0;
%----------Pfa------------%
Pf=0.01:0.01:1;
Pfa=Pf.^2;
%---------signal-----%
t=1:N;
s1 = cos(pi*t);
% s1power=var(s1);


%-------- SNR ----------%
% Snrdb=-15:1:15;
Snrdb=15;
Snreal=power(10,Snrdb/10);%Linear Snr

% while Snrdb<15
for i=1:length(Pfa)
lamda(i)=gammaincinv(1-Pfa(i),u)*2; %theshold
% lamdadB=10*log10(lamda);


%---------Local spectrum sensing---------%

for j=1:Crs %for each node
detect=0;
% d(j)=7+1.1*rand(); %random distanse
d=7:0.1:8;
PL=C*(d(j)^-a); %path loss

for sim=1:10%Monte Carlo Simulation for 100 noise realisation

%-------------AWGN channel--------------------%
noise = randn(1,N); %Noise production with zero mean and s^2 var
noise_power = mean(noise.^2); %noise average power
amp = sqrt(noise.^2*Snreal);
s1=amp.*s1./abs(s1);
% SNRdB_Sample=10*log10(s1.^2./(noise.^2));
Rec_signal=s1+noise;%received signal
localSNR(j)=mean(abs(s1).^2)*PL/noise_power;%local snr
Pdth(j,i)=marcumq(sqrt(2*localSNR(j)),sqrt(lamda(i )),u);%Pd for j node

%Computation of Test statistic for energy detection
Sum=abs(Rec_signal).^2*PL;
Test(j,sim)=sum(Sum);
if (Test(j,sim)>lamda(i))
detect=detect+1;
end

end %END Monte Carlo

Pdsim(j)=detect/sim; %Pd of simulation for the j-th CRuser


end
PdAND(i)=prod(Pdsim);
PdOR(i)=1-prod(1-Pdsim);

end


PdAND5=(Pdth(5,:)).^5;
Pmd5=1-PdAND5;
PdANDth=(Pdth(Crs,:)).^Crs;
PmdANDth=1-PdANDth; %Probability of miss detection
Pmdsim=1-PdAND;
figure(1);
plot(Pfa,Pmdsim,'r-*',Pfa,PmdANDth,'k-o',Pfa,Pmd5,'g-*');
title('Complementary ROC of Cooperative sensing with AND rule under AWGN');
grid on
axis([0.0001,1,0.0001,1]);
xlabel('Probability of False alarm (Pfa)');
ylabel('Probability of Missed Detection (Pmd)');
legend('Simulation','Theory n=10','Theory n=5');

Expecting reply with thanks

"sesham srinu" <seshamsrinu83@gmail.com> wrote in message <hs44pp$dou$1@fred.mathworks.com>...
> "Vivi Sera" <vivi.seraphic@gmail.com> wrote in message <hrmljm$htd$1@fred.mathworks.com>...
> > I am doing a term project in spectrum sensing as well, probably focus on cooperative schemes, but will start with the conventional one, such as energy detection, matched filter, etc etc. If any of you have some good scripts for me to start off, would it be okay for you to share with me, please? I really appreciate it!
> hai iam sesham srinu from university of hyderabad,india
> %Entropy estimation of a stochastic signal for primary user detection for the matched filter case
>
>
> clear all;clc;
>
> %**************************************Input parameters**********************************************************************************
>
> b = [ 1 0 0 1 1]; % Input bit stream
>
> N=[16 32 64];
>
> for j=1:length(N)
> snr_db=0:1:20;
> g=length(snr_db);
> %*************************************BPSK signal generation, Matched filtering and Sampling********************************************
> for z=1:length(snr_db)
>
> [signal]=bpsk(b); %BPSK signal generation
> signal_fad=b_fad(signal); %fading
> [s_matched signal_noise noise]=match(signal_fad,snr_db(z)); % matched filtered output of Qpsk signal
>
>
> %************************************Entropy anlaysis after matched filter output is sampled********************************************
>
>
> L=N(j); %No.of bins
>
> s=s_matched(1:N(j)); % N no.of samples Sampled output of matched filter
>
> x=[ ];
> x=s(1:N(j)); %block of N samples of matched filter to make decision
>
> noise=noise(1:N(j));
>
> K=4;
> sq=sum(x.^2)/N(j);
> sigma = sqrt(sum(x.^2)/N(j));
> %**********************************checking for chebyeshev inequality*******************************************************************
> count=0;
> for i=1:N(j)
> if(abs((x(i)-mean(x)))>(K*sigma))
> count=count+1;
>
> else
> count=count;
> end
> end
>
> if ((count/N(j))<= (1/(K^2)))
>
> %display('Design value of K is correct ');
>
> else
> %display('Design value of K is incorrect and try for another value');
>
> end
>
> % %***********************************Histogram of x**************************************************************************************
> v1=(2*K*sigma)/(L); % Width of each bin
> v=-K*sigma:v1 :K*sigma; % a vector specifying the centres of bins from where to start and stop.
>
> %***********************************Checking for no.of values of x fallong inside the kth bin********************************************
>
> pa11=0;
> pa01=0; y1=0;e(z)=0;
> for k=1:L;
>
> number_samples=0;
>
>
>
> lk(k)=v(k)-(v1/2);
> lkplus1(k)=v(k)+(v1/2);
>
> for i=1:N(j)
> if((lk(k)<x(i))& (x(i)<lkplus1(k)))
> number_samples=number_samples+1;
> else
> number_samples=number_samples+eps;
> end
> end
>
> nk=number_samples;
>
> y1=y1+number_samples;
> %----------------------------------------Entropy caculation------------
>
> if(nk~=0)
> nk=nk;
> else
> nk=nk+eps;
>
> end
> p(k) = -((nk/N(j))*log2(nk/N(j)));
> e(z)= e(z)+p(k) ; %Entropy estimate
>
>
>
>
> %********************************************computing pk(a)********************************************************************************
> a1=snr_db(z);
>
> a0=0;
>
> pk1=0;pk0=0; M=2; u(1)=1;u(2)=-1;
> for m=1:M
> h1(m)=0;h2(m)=0;h3(m)=0;h4(m)=0;
>
> h1(m)=(lk(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
> h2(m)=(lkplus1(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
> h3(m)=(lk(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
> h4(m)= (lkplus1(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
>
>
>
> pk1=pk1+[[qfunc(h1(m))]-[qfunc(h2(m))]];
> pk0=pk0+[[qfunc(h3(m))]-[qfunc(h4(m))]];
>
> end
>
> pka1= (1/M)*pk1+eps;
> pka0= (1/M)*pk0+eps;
>
> %*********************************************computing log-likelihood ratio***************************************************************
>
> pa11=pa11+(nk/N(j))*[log2(pka1)-log2(pka0)];
>
>
> end
>
> le(z)=pa11;%Log-likelihood ratio of entropy
> end
>
> e1((j+(j-1)*20):j*21)=e;
> le1((j+(j-1)*20):j*21)=le;
> end
>
>
>
> plot(snr_db,e1(1:21),'-b*',snr_db,e1(22:42),'-ro',snr_db,e1(43:63),'-g.');
> xlabel('SNR in db');
> ylabel('Entropy');
> title('Normal entropy');
> h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);
>
> figure
> plot(snr_db,le1(1:21),'-b*',snr_db,le1(22:42),'-ro',snr_db,le1(43:63),'-g.');
> xlabel('SNR in db');
> ylabel('Log-likelihood Entropy');
> title('log-likelihood entropy')
> h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);
>
>
>

Subject: cognitive radio

From: Mobien

Date: 8 Jan, 2012 12:49:07

Message: 41 of 46

Hi All,

The best way to start a project is to divide it into small milestones.

I think in this case first you all must simulate a simple bpsk system with noise. See if you can transmit and receive bits and if your ber curve matches the text book.
The next step should be to add a matched filter.
The final stage will be to implement a sensing algorithm based on whatever technique.

You must also try to understand what does probability of false alarm mean and what is the probability of detection.

Using this approach you all can gain alot. Even if the project does not finish on time atleast you've something to show.



"krithi vengat" wrote in message <jeauik$ndq$1@newscl01ah.mathworks.com>...
> HI
> I get ur MATLAB coding for my project but it shows error in signal generation of BPSK. Since I'm new to MATLAB I'm unable to recover, can u suggest me some idea. And also I need MATLAB coding for Co-operative spectrum sensing for probability of false alarm detection.
> I've some code pl go thro' it and tel wat correction i need to do.
>
> clear all;
> close all;
> clc
>
>
> u=1000;%time bandwidth factor
> N=2*u;%samples
> a=2;%path loss exponent
> C=2;%constant losses
> Crs=10; %Number of cognitive radio users
> PdAnd=0;
> %----------Pfa------------%
> Pf=0.01:0.01:1;
> Pfa=Pf.^2;
> %---------signal-----%
> t=1:N;
> s1 = cos(pi*t);
> % s1power=var(s1);
>
>
> %-------- SNR ----------%
> % Snrdb=-15:1:15;
> Snrdb=15;
> Snreal=power(10,Snrdb/10);%Linear Snr
>
> % while Snrdb<15
> for i=1:length(Pfa)
> lamda(i)=gammaincinv(1-Pfa(i),u)*2; %theshold
> % lamdadB=10*log10(lamda);
>
>
> %---------Local spectrum sensing---------%
>
> for j=1:Crs %for each node
> detect=0;
> % d(j)=7+1.1*rand(); %random distanse
> d=7:0.1:8;
> PL=C*(d(j)^-a); %path loss
>
> for sim=1:10%Monte Carlo Simulation for 100 noise realisation
>
> %-------------AWGN channel--------------------%
> noise = randn(1,N); %Noise production with zero mean and s^2 var
> noise_power = mean(noise.^2); %noise average power
> amp = sqrt(noise.^2*Snreal);
> s1=amp.*s1./abs(s1);
> % SNRdB_Sample=10*log10(s1.^2./(noise.^2));
> Rec_signal=s1+noise;%received signal
> localSNR(j)=mean(abs(s1).^2)*PL/noise_power;%local snr
> Pdth(j,i)=marcumq(sqrt(2*localSNR(j)),sqrt(lamda(i )),u);%Pd for j node
>
> %Computation of Test statistic for energy detection
> Sum=abs(Rec_signal).^2*PL;
> Test(j,sim)=sum(Sum);
> if (Test(j,sim)>lamda(i))
> detect=detect+1;
> end
>
> end %END Monte Carlo
>
> Pdsim(j)=detect/sim; %Pd of simulation for the j-th CRuser
>
>
> end
> PdAND(i)=prod(Pdsim);
> PdOR(i)=1-prod(1-Pdsim);
>
> end
>
>
> PdAND5=(Pdth(5,:)).^5;
> Pmd5=1-PdAND5;
> PdANDth=(Pdth(Crs,:)).^Crs;
> PmdANDth=1-PdANDth; %Probability of miss detection
> Pmdsim=1-PdAND;
> figure(1);
> plot(Pfa,Pmdsim,'r-*',Pfa,PmdANDth,'k-o',Pfa,Pmd5,'g-*');
> title('Complementary ROC of Cooperative sensing with AND rule under AWGN');
> grid on
> axis([0.0001,1,0.0001,1]);
> xlabel('Probability of False alarm (Pfa)');
> ylabel('Probability of Missed Detection (Pmd)');
> legend('Simulation','Theory n=10','Theory n=5');
>
> Expecting reply with thanks
>
> "sesham srinu" <seshamsrinu83@gmail.com> wrote in message <hs44pp$dou$1@fred.mathworks.com>...
> > "Vivi Sera" <vivi.seraphic@gmail.com> wrote in message <hrmljm$htd$1@fred.mathworks.com>...
> > > I am doing a term project in spectrum sensing as well, probably focus on cooperative schemes, but will start with the conventional one, such as energy detection, matched filter, etc etc. If any of you have some good scripts for me to start off, would it be okay for you to share with me, please? I really appreciate it!
> > hai iam sesham srinu from university of hyderabad,india
> > %Entropy estimation of a stochastic signal for primary user detection for the matched filter case
> >
> >
> > clear all;clc;
> >
> > %**************************************Input parameters**********************************************************************************
> >
> > b = [ 1 0 0 1 1]; % Input bit stream
> >
> > N=[16 32 64];
> >
> > for j=1:length(N)
> > snr_db=0:1:20;
> > g=length(snr_db);
> > %*************************************BPSK signal generation, Matched filtering and Sampling********************************************
> > for z=1:length(snr_db)
> >
> > [signal]=bpsk(b); %BPSK signal generation
> > signal_fad=b_fad(signal); %fading
> > [s_matched signal_noise noise]=match(signal_fad,snr_db(z)); % matched filtered output of Qpsk signal
> >
> >
> > %************************************Entropy anlaysis after matched filter output is sampled********************************************
> >
> >
> > L=N(j); %No.of bins
> >
> > s=s_matched(1:N(j)); % N no.of samples Sampled output of matched filter
> >
> > x=[ ];
> > x=s(1:N(j)); %block of N samples of matched filter to make decision
> >
> > noise=noise(1:N(j));
> >
> > K=4;
> > sq=sum(x.^2)/N(j);
> > sigma = sqrt(sum(x.^2)/N(j));
> > %**********************************checking for chebyeshev inequality*******************************************************************
> > count=0;
> > for i=1:N(j)
> > if(abs((x(i)-mean(x)))>(K*sigma))
> > count=count+1;
> >
> > else
> > count=count;
> > end
> > end
> >
> > if ((count/N(j))<= (1/(K^2)))
> >
> > %display('Design value of K is correct ');
> >
> > else
> > %display('Design value of K is incorrect and try for another value');
> >
> > end
> >
> > % %***********************************Histogram of x**************************************************************************************
> > v1=(2*K*sigma)/(L); % Width of each bin
> > v=-K*sigma:v1 :K*sigma; % a vector specifying the centres of bins from where to start and stop.
> >
> > %***********************************Checking for no.of values of x fallong inside the kth bin********************************************
> >
> > pa11=0;
> > pa01=0; y1=0;e(z)=0;
> > for k=1:L;
> >
> > number_samples=0;
> >
> >
> >
> > lk(k)=v(k)-(v1/2);
> > lkplus1(k)=v(k)+(v1/2);
> >
> > for i=1:N(j)
> > if((lk(k)<x(i))& (x(i)<lkplus1(k)))
> > number_samples=number_samples+1;
> > else
> > number_samples=number_samples+eps;
> > end
> > end
> >
> > nk=number_samples;
> >
> > y1=y1+number_samples;
> > %----------------------------------------Entropy caculation------------
> >
> > if(nk~=0)
> > nk=nk;
> > else
> > nk=nk+eps;
> >
> > end
> > p(k) = -((nk/N(j))*log2(nk/N(j)));
> > e(z)= e(z)+p(k) ; %Entropy estimate
> >
> >
> >
> >
> > %********************************************computing pk(a)********************************************************************************
> > a1=snr_db(z);
> >
> > a0=0;
> >
> > pk1=0;pk0=0; M=2; u(1)=1;u(2)=-1;
> > for m=1:M
> > h1(m)=0;h2(m)=0;h3(m)=0;h4(m)=0;
> >
> > h1(m)=(lk(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
> > h2(m)=(lkplus1(k)-u(m)*sqrt(a1/(1+a1)))*(1+a1);
> > h3(m)=(lk(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
> > h4(m)= (lkplus1(k)-u(m)*sqrt(a0/(1+a0)))*(1+a0);
> >
> >
> >
> > pk1=pk1+[[qfunc(h1(m))]-[qfunc(h2(m))]];
> > pk0=pk0+[[qfunc(h3(m))]-[qfunc(h4(m))]];
> >
> > end
> >
> > pka1= (1/M)*pk1+eps;
> > pka0= (1/M)*pk0+eps;
> >
> > %*********************************************computing log-likelihood ratio***************************************************************
> >
> > pa11=pa11+(nk/N(j))*[log2(pka1)-log2(pka0)];
> >
> >
> > end
> >
> > le(z)=pa11;%Log-likelihood ratio of entropy
> > end
> >
> > e1((j+(j-1)*20):j*21)=e;
> > le1((j+(j-1)*20):j*21)=le;
> > end
> >
> >
> >
> > plot(snr_db,e1(1:21),'-b*',snr_db,e1(22:42),'-ro',snr_db,e1(43:63),'-g.');
> > xlabel('SNR in db');
> > ylabel('Entropy');
> > title('Normal entropy');
> > h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);
> >
> > figure
> > plot(snr_db,le1(1:21),'-b*',snr_db,le1(22:42),'-ro',snr_db,le1(43:63),'-g.');
> > xlabel('SNR in db');
> > ylabel('Log-likelihood Entropy');
> > title('log-likelihood entropy')
> > h2=legend('N=16 BPSK','N=32 BPSK','N=64 BPSK',1);
> >
> >
> >

Subject: cognitive radio

From: krithi vengat

Date: 22 Jan, 2012 19:36:29

Message: 42 of 46

Will you please post the coding which you used for probability of detection?
 "nancy " <nancy.gonzalvis@gmail.com> wrote in message <g9r22h$h0g$1@fred.mathworks.com>...
> hello
>
> as i posted the spectrum sensing problem earlier i wanted to
> know about the probability of false alarm. i worked out for
> the probability of detection and got the curve as given by
> the paper of Bhargava et. al. i calculated the probability
> of detection by first finding the individual detection using
> energy detection and then dividing the number of times the
> detection is produced with the number of iteration. now i
> want to find the probability of false alarm but am not
> getting any idea to implement it in matlab. anybody has any
> idea to calculate the probability of false alarm. please
> help me...
> thank u

Subject: cognitive radio

From: gopinath R

Date: 12 Mar, 2012 10:10:14

Message: 43 of 46

any one having matlab code for probability of detection vs snr then plz do share it :)

Subject: cognitive radio

From: jaya pavi

Date: 9 Sep, 2012 03:46:08

Message: 44 of 46

"nancy " <nancy.gonzalvis@gmail.com> wrote in message <g7gnkp$qhj$1@fred.mathworks.com>...
> hello
> i'm working on spectrum sensing techniques in cognitive
> radio...it is an emerging topic and we don't find any codes
> or any help for it. i'm also facing problems as i have to
> start fresh...if anyone has any codes related to it could u
> please send me some too...it would be the greatest help for
> me in doing my project...
> thank u in advance
> nancy

hi. i am working on opportunistic spectrum access in cognitive radio through q learning.
if u have any codes related to this can u mail me.my id is jayapavithra25@gmail.com

Subject: cognitive radio

From: amit

Date: 21 Nov, 2012 15:05:08

Message: 45 of 46

hi, im also stuck on my matlab code for cognitive radio, it doesnt seem to work. i need graphs for pf vs pd and then introduce noise later on. my code so far is:
Could really do with some help and pointers. thanks!
amit703@hotmail.com

%monte carlo simulation
function [y1,y2,y3,y4]= ed(SNRL,SNRS,SNRH,n) %ed is the energy detection
g1= SNRL:SNRS:SNRH;
g=10.^(g1/10);
beta=0.01; % is the probability of flase alarm

pf1=zeros(1,length(g));
pd1=zeros(1,length(g));
pf2=zeros(1,length(g));
pd2=zeros(1,length(g));

 for i=1 : length(g)
     y0 = randn(n,1000000);
     y1= randn(n,1000000)*sqrt(g(i))+y0;
    
    
     Tgam = gaminv(1-beta,n/2,2/n*(1+g(i))); %threshold
     pf1(i)= gamcdf(Tgam,n/2,2/n*(1+g(i)))
     pd1 (i) = gamcdf(Tgam,n/2,2/n); % prob of detection
     pf2(i)= length (find(sum(y1.^2)/n<Tgam))/1000000;
     pd2 (i) = length (find(sum(y0.^2)/n<Tgam))/1000000;
 
 end
 y1=pf1; y2=pd1; y3=pf2; y4=pd2;

Subject: cognitive radio

From: ABDUL

Date: 5 Dec, 2012 06:46:07

Message: 46 of 46

i am doing spectrum sensing by energydetection using sliding window.can any one tel me how to code sliding window in matlab.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us