Question

I am working in matlab the M-QAM modulation with Rayleigh fading, and i have a little problem with the integration part, i have made that code with an aproximation:

function y = m_qam_ray( M )
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes here
% simulation for M-QAM transmission
EbNodB = [0:2:40];
EbNolin = 10.^(EbNodB/10) ;
Pe_sim=[];

% For M-QAM
if(M==4)
a=1;
else
a=4/log2(M);
end
b=3*log2(M)/(M-1);
Pe=[];
for i = 1:((40/2)+1),
    Pe= [Pe 0.5*a*(1-sqrt(0.5*b*EbNolin(i)/(1+0.5*b*EbNolin(i))))]; %THE APROXIMATION
end                      % Ref: Wireless Communication, A. Goldsmith

semilogy(EbNodB,Pe)
xlabel('SNR, EbNo(dB)');
ylabel('Bit error probability, Pe');
title('Theoretical results of BER of M-QAM');
legend(num2str(M));
legend('-DynamicLegend')
hold off

end

That code works correctly but now i need to do a modification, the line indicated by aproximation has to be modified, instead of

    0.5*a*(1-sqrt(0.5*b*EbNolin(i)/(1+0.5*b*EbNolin(i))))

i need a new value that would be:

(a/pi)*int((a/pi)*mgf*(-b/(2*((sin(phi))^2)) integrated from phi = 0..pi/2

where

mgf = (2*(sin(phi))^2)/(2*(sin(phi))^2+b*EbNolin)

So I have modified my code as:

function y= m_qam_ray2(M)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
% simulation for M-QAM transmission
EbNodB = [0:2:40];
EbNolin = 10.^(EbNodB/10) ;
%Pe_sim=[];
if(M==4)
    a=1; %Amplitud alpha_m
else
    a=(4/log2(M))*(1-(1/sqr(M)));
end

b=3*log2(M)/(M-1); %beta_m

%mgf= (2*(sin(phi))^2)/(2*(sin(phi))^2+b*EbNolin);

Pe=[];

for i = 1:((40/2)+1),

    Pe= [Pe (a/pi)*int((a/pi)*((2*((sin(phi))^2)/(2*((sin(phi))^2)+b*EbNolin(i)))*(-b/(2*((sin(phi))^2)), phi = 0..pi/2)];
end                      % Ref: Wireless Communication, A. Goldsmith

semilogy(EbNodB,Pe)
xlabel('SNR, EbNo(dB)');
ylabel('Bit error probability, Pe');
title('Theoretical results of BER of M-QAM');
legend(num2str(M));
legend('-DynamicLegend')
hold off

end

In every loop of i I am doing the integral between 0 and pi/2 (i know it's not very eficient, but now i only need it to work), but i am getting errors constantly and dont know exactly why, the error line is the

 Pe = [Pe (a/pi)*int(((2*((sin(phi))^2)/(2*((sin(phi))^2)+b*EbNolin(i)))*(-b/(2*((sin(phi))^2)))),  phi = 0..pi/2)];

the error is ??? Error: File: m_qam_ray2.m Line: 22 Column: 108 The expression to the left of the equals sign is not a valid target for an assignment.

And i dont know if it is because my loop is bad programed or it is because of the integral.

I would be very grateful if someone could help.

Thanks :)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top