Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] M2M4M6 moments based snr estimation

Status
Not open for further replies.

Shruti01

Member level 3
Joined
Apr 14, 2010
Messages
67
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
Mumbai, India
Activity points
1,941
Hello,

I have written a matlab code for snr estimation based on M2, M4 and M6 moments for 16 QAM signal. I am not able to get the estimated value of snr. Kindly have a look at the code and let me know what is wrong. I have also attached a doc file for your reference. The code is pretty easy to understand. You can also refer to the attached doc file for better understanding of the matlab code.


The matlab code is as follows:

Code:
clc 
clear 
% Generate data. 
M = 16; % Alphabet size 
Pd = 2000; % Length of data 
k = log2(M); % Number of bits per symbol
x = randi([0,1],Pd,1); % Random binary bit stream
hBitToInt = comm.BitToInteger(k);
xsym = step(hBitToInt,x); % Convert the bits in x into k-bit symbols
qamsig = modulate(modem.qammod(M),xsym); % QAM signal 
snr_theory = 0:2:20; % Theoretical value of SNR 
QQ = 10.^(snr_theory/10); % SNR in decimal 
P1=1/4;
P2=3/4;
R(1)=1;
R(2)=3.15;
c2 = 1;
c4 = R(1).^4.*P1+R(2).^4.*P2;
c6 = R(1).^6.*P1+R(2).^6.*P2;
c8 = R(1).^8.*P1+R(2).^8.*P2;
c10 = R(1).^10.*P1+R(2).^10.*P2; 
for a=1:length(snr_theory) 
    SNR=num2str(snr_theory(a)); 
    for n=1:2000 
        rxsig = awgn(qamsig,snr_theory(a)); % Add Gaussion noise
        M2 = mean(rxsig.^2); % Second order moment 
        M4 = mean(rxsig.^4); % Fourth order moment 
        M6 = mean(rxsig.^6); % Sixth order moment
        m=(M2.*M4)./M6;
        v=[((m.*c6)-c4) ((9.*m.*c4)-c4-4) ((18.*m)-6) ((6.*m)-2)];
        r=roots(v);
        r(2);
        snr_est_M2M4M6(n) = 10.*log10(abs(r(2)));
        M2M4M6_snr_est(a) = mean(snr_est_M2M4M6); % estimation value 
        snr_est12(n) = 10.^(snr_est_M2M4M6(n)/10); % SNR in decimal 
        snr_est2(a) = mean(snr_est12);  
        NMSE_M2M4M6(a) = mean(((QQ(a)-snr_est12)/QQ(a)).^2); % Normalized MSE 
        STD_M2M4M6(a) = var(snr_est_M2M4M6); %standard deviation 
        NB_M2M4M6(a) = mean((QQ(a)-snr_est12)./QQ(a)); % normalized bias 
    end 
end 
figure(1) 
%plot estimation value 
plot(snr_theory,snr_theory); 
hold on 
plot(snr_theory,M2M4M6_snr_est,'-o'); 
hold off 
figure(2) 
% plot estimation NMSE 
semilogy(snr_theory,NMSE_M2M4M6,'-*') 
figure(3) 
% plot estimation STD 
plot(snr_theory,STD_M2M4M6,'-*') 
figure(4) 
% plot estimation NB 
plot(snr_theory,NB_M2M4M6,'-*') 
grid
 

Attachments

  • m2m4m6 doc file.doc
    46.5 KB · Views: 50
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top