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:
nakagami-m MGF average probability bpsk

Subject: nakagami-m MGF average probability bpsk

From: edin

Date: 15 Jan, 2009 20:01:28

Message: 1 of 5

I have problem with this file:

clear;
clc;
M=4;
m=4;
gpsk=(sin(pi/M))^2;
gamasr_dB=[1:0.1:20];



for j=1:length(gamasr_dB)
    gamasr(j)=10.^(gamasr_dB(j)/10);
    alfa(j)=sqrt((gpsk.*gamasr(j)/m)/(1+(gpsk.*gamasr(j)/m)))*cot(pi/M);
    K(j)=(1/pi)*sqrt((gpsk.*gamasr(j)/m)/(1+gpsk.*gamasr(j)/m));
   
    suma1=0;
    for k=0:(m-1)
        
        suma1=suma1 +(factorial(2*k)/(factorial(k)^2))*1/(4*(1+(gpsk.*gamasr(j)/m))^k);
  
    end;
  
    suma2=0;
    for k=1:(m-1)
        for i=1:k
            T(i)=(factorial(2*k)/(factorial(k)^2))/(factorial(2*(k-i))/(((factorial(k-i))^2)*(4^i)*(2*(k-i)+1)));
            BR(i)=T(i)*(cos(atan(alfa(j))))^(2*(k-i)+1);
        end;
            suma2=suma2+BR(i)/(1+gpsk.*gamasr(j)/m)^k;
    end;
    
Ps(j)=((M-1)/M)-K(j)*((pi/2+atan(alfa(j)))*suma1+sin(atan(alfa(j))*suma2));
Pb(j)=Ps(j)/log2(M);
end;
semilogy(gamasr_dB,Pb);
grid on
hold on

Subject: nakagami-m MGF average probability bpsk

From: Sadik

Date: 15 Jan, 2009 20:42:02

Message: 2 of 5

edin <edo_heineken@hotmail.com> wrote in message <5473317.1232049736743.JavaMail.jakarta@nitrogen.mathforum.org>...
> I have problem with this file:
>
> clear;
> clc;
> M=4;
> m=4;
> gpsk=(sin(pi/M))^2;
> gamasr_dB=[1:0.1:20];
>
>
>
> for j=1:length(gamasr_dB)
> gamasr(j)=10.^(gamasr_dB(j)/10);
> alfa(j)=sqrt((gpsk.*gamasr(j)/m)/(1+(gpsk.*gamasr(j)/m)))*cot(pi/M);
> K(j)=(1/pi)*sqrt((gpsk.*gamasr(j)/m)/(1+gpsk.*gamasr(j)/m));
>
> suma1=0;
> for k=0:(m-1)
>
> suma1=suma1 +(factorial(2*k)/(factorial(k)^2))*1/(4*(1+(gpsk.*gamasr(j)/m))^k);
>
> end;
>
> suma2=0;
> for k=1:(m-1)
> for i=1:k
> T(i)=(factorial(2*k)/(factorial(k)^2))/(factorial(2*(k-i))/(((factorial(k-i))^2)*(4^i)*(2*(k-i)+1)));
> BR(i)=T(i)*(cos(atan(alfa(j))))^(2*(k-i)+1);
> end;
> suma2=suma2+BR(i)/(1+gpsk.*gamasr(j)/m)^k;
> end;
>
> Ps(j)=((M-1)/M)-K(j)*((pi/2+atan(alfa(j)))*suma1+sin(atan(alfa(j))*suma2));
> Pb(j)=Ps(j)/log2(M);
> end;
> semilogy(gamasr_dB,Pb);
> grid on
> hold on

Hello edin,

What problem do you have? Please indicate the line at which the program gives error and also give a copy of the error message.

Thanks.

Subject: nakagami-m MGF average probability bpsk

From: Roger Stafford

Date: 15 Jan, 2009 21:24:01

Message: 3 of 5

edin <edo_heineken@hotmail.com> wrote in message <5473317.1232049736743.JavaMail.jakarta@nitrogen.mathforum.org>...
> .......
> for k=1:(m-1)
> for i=1:k
> T(i)=(factorial(2*k)/(factorial(k)^2))/(factorial(2*(k-i))/(((factorial(k-i))^2)*(4^i)*(2*(k-i)+1)));
> BR(i)=T(i)*(cos(atan(alfa(j))))^(2*(k-i)+1);
> end;
> suma2=suma2+BR(i)/(1+gpsk.*gamasr(j)/m)^k;
> end;
> ........

  I see something fishy here. In the line

    suma2=suma2+BR(i)/(1+gpsk.*gamasr(j)/m)^k;

you are using the index i outside of the for-loop that was indexing with i. I think what you get will be the last value of i in the loop. I don't think that is what you had in mind. Perhaps you meant for the line to be inside the loop.

Roger Stafford

Subject: nakagami-m MGF average probability bpsk

From: edin

Date: 15 Jan, 2009 21:27:32

Message: 4 of 5

I"ve sent you a mail ,with a attach file, to your acount : sadik.hava@gmail.com about my problem and hope you can help me , because I don"t know how to add a attach in this forum. Thanks

Subject: nakagami-m MGF average probability bpsk

From: edin

Date: 15 Jan, 2009 21:55:24

Message: 5 of 5

what should I have to do? What is enough?

Tags for this Thread

No tags are associated with 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