⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 evaluteffbperf.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
%  Evaluates Perfomance of FastFeedBack Matlab Kernel
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: evaluteFFBPerf.m.rca $
%  Tag $Name:  $
%  $Revision: 1.2 $
%  $Date: Fri Dec  1 15:02:01 2006 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%-- Matlab files used by this file
%mFastFeedback
%LUT
%--

function evaluteFFBPerf

addpath('./..')

%-- General Settings
generateTV=1;
DataRange = 64;
SNRgap= 4;


%-- Generate the 64 vectors
P0=exp(i*pi/4);
P1=exp(i*pi*3/4);
P2=exp(-i*pi*3/4);
P3=exp(-i*pi*1/4);
l0 = [ P0; P1; P2; P3; P0; P1; P2; P3];
l1 = [ P0; P3; P2; P1; P0; P3; P2; P1];
l2 = [ P0; P0; P1; P1; P2; P2; P3; P3];
l3 = [ P0; P0; P3; P3; P2; P2; P1; P1];
l4 = [ P0; P0; P0; P0; P0; P0; P0; P0];
l5 = [ P0; P2; P0; P2; P0; P2; P0; P2];
l6 = [ P0; P2; P0; P2; P2; P0; P2; P0];
l7 = [ P0; P2; P2; P0; P2; P0; P0; P2];
tileLUT =  [l0 l1 l2 l3 l4 l5 l6 l7 ];

[LUT_SORTED, LUT_SORTED_full, LUTposs, LUTposs2,LUT_NONSORTED] = LUT;
temp = num2str(LUT_NONSORTED(:,2)+ones(64,1)*1e6);
temp = temp(:,2:end);

vectors = zeros(48,64);
ref = zeros(1,64);
for k=1:64
    for tile=1:6
        l(tile)=str2num(temp(k,tile));
        tileLUT(:,l(tile)+1);
        vectors(8*(tile-1)+1 :  8*(tile)   ,k) = tileLUT(:,l(tile)+1);
    end
    ref(k) = LUT_NONSORTED(k,1);
end

%-- Norm vectors and apply range.
vectors_N1=vectors./max(max(real(vectors)));
vectors=DataRange*round(vectors_N1);



%-- Create a realistic vector serie if no TV generation
if generateTV
    Nvec = 64; step=1;
    x=[1:step:Nvec*step];
    myVectors = vectors;
    myRef = x;
else
    Nvec = 629; step=0.01;
    x=[0:step:Nvec*step];
    y=sin(x)*DataRange/2 + DataRange/2;
    noise = (rand(1,Nvec+1)-0.5)*SNRgap;
    vectorsIndex = round(y+noise);
    vectorsIndex = min(vectorsIndex,64);
    vectorsIndex = max(vectorsIndex,1);
    vectorsIndex = round(vectorsIndex);
    for k=1:Nvec
        indice = vectorsIndex(1,k);
        myVectors(:,k) = vectors(:,indice);
        myRef(k) = indice;
    end
end


% Testing (NOISE ON)
disp('Testing Matlab model mFastFeedback with noise.')
[m n]=size(myVectors);
detectErrors=[];
c=0;
rep = 1000;
SNRrange=[[-10:5]];
%CRange = [0.4:0.1:1];
CRange = [1];
tic
c2=1;
c3=1;

c4=1;
for C=CRange
    c=0;
    disp(['C: ' num2str(C) ])

    for SNR=SNRrange

        disp(['SNR: ' int2str(SNR) ])
        c=c+1;

        for l = 1: rep

            %vector by vector
            global FFB_lastPayload;
            global FFB_lastIndex;
            FFB_lastPayload=[]; %reinitialise process
            FFB_lastIndex = [];

            for k=1:n

                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                % AWGN channel
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if SNR==Inf
                    vectorsNoisy(:,k) = myVectors(:,k);
                else %noise on
                    SigPwr=mean(myVectors(:,k).*conj(myVectors(:,k)));
                    dBW=10*log10(SigPwr);
                    vectorsNoisy(:,k) = double(int16(awgn(myVectors(:,k),SNR,dBW)));
                    %Noise= vectorsNoisy(:,k)-myVectors(:,k);
                    %mean(Noise.*conj(Noise));
                    %InsertedSNR(k)=10*log10(SigPwr/mean(Noise.*conj(Noise)));
                    %disp(['InsertedSNR: ' num2str(InsertedSNR) ]);
                end

                [mOut(k), confidenceFactor(k)] =  mFastFeedback(vectorsNoisy(:,k),C);
                result(k) = (mOut(k)~=myRef(k));

            end
            temp_result(l) = sum(result);
        end
        detectErrors(c4,c)= sum(temp_result) ;
    end
    c4=c4+1;
end

[CRange' detectErrors ];
figure
semilogy(SNRrange,detectErrors./(Nvec*rep),'*-')
grid on
xlabel('SNR')
ylabel('Detection Error Rate')
legendString = num2str(CRange');
n=size(legendString,1);
s='Conf.Fac.Floor = ';
legendString2=s;
for p=2:n
    legendString2=[legendString2;s];
end
legendString = [legendString2 legendString];
legend(legendString);
title('mFastFeedback Performances within AWGN Environnement')

rmpath('./..')



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -