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

📄 test_eqzfcompare.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: test_EqZFCompare.m.rca $
%  $Revision: 1.3 $
%  $Date: Mon Oct 30 16:26:20 2006 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Compares the outputs from EqZFCompare.m and EqZFCompare.dll
%
%           status = test_EqZFCompare(seed)
%

%-- Matlab files used by this file
% mEqZF
%-- End of list

function [status] = test_EqZFCompare(seed)

% clear global
% clear functions
% close all


addpath('../');
addpath('../../../../../../../Manager/CM/Utilities/matlab');


dataSize = 48;
fname = 'EqZF';
QIN = 15;
QCHANEST = 31;
QOUT = 15;

if (exist('seed','var') == 0)
    seed = sum(100*clock);
end
rand('state',seed);

%system(['rm ../../vector/log/TCRND/',fname,'.txt']);
%diary(['../../vector/log/TCRND/',fname,'.txt']);

disp('EqZF Simulation');
disp('=====================================');
disp(' ');
%%%%%%%%%%%%%%%%%%%%%% Initialize Paramters %%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('*********Initializing Parameters*********')
disp(strcat('SEED = ',num2str(seed)));

% generates pilot random data , include the 4/3 Pilot boosting
InReal = round((2^(QIN+1)-1).*rand(1,dataSize)-2^QIN);
InImag = round((2^(QIN+1)-1).*rand(1,dataSize)-2^QIN);
In_fixed = InReal + InImag*i;



In = In_fixed./2^QIN;
ChanEstReal = round((2^(QCHANEST+1)-1).*rand(1,dataSize)-2^QCHANEST);
ChanEstImag = round((2^(QCHANEST+1)-1).*rand(1,dataSize)-2^QCHANEST);
ChanEst_fixed = ChanEstReal + ChanEstImag*i;
ChanEst_fixed(1:5)';
ChanEst = ChanEst_fixed./2^QCHANEST;


%-- with factor=1 in EqZF => not same outputs type for the matlab function and the
% dll(not scaling in dll) => this means the dll and matlab function are not
% aligned !!! However the final outputs are doing fine
mOut = mEqZF(In,ChanEst);
mOut_fixed = round(mOut.*2^QOUT);
In_fx=round(In.*2^QOUT);
ChanEst_fx=round(ChanEst.*2^QCHANEST);
In_fx(1:5)';
ChanEst_fx(1:5)';
fpOut_fixed = EqZF(In_fx,ChanEst_fx);

%-- display results
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff = (mOut_fixed - fpOut_fixed);
diff(1:5)';
disp( ['max(abs(real(diff))) = ' num2str(max(abs(real(diff))))]);
disp( ['max(abs(imag(diff))) = ',num2str(max(abs(imag(diff))))]);
diff2 = (mOut_fixed - fpOut_fixed)./max(fpOut_fixed);
diff_pc = diff2.*100;
rdiff_pc=real(diff_pc);
idiff_pc=imag(diff_pc);
disp( ['max(abs(rdiff_pc)) = ' num2str(max(abs(rdiff_pc))) ' %.']);
disp( ['max(abs(idiff_pc)) = ' num2str(max(abs(idiff_pc))) ' %.']);
figure(1)
plot(rdiff_pc,'^-b');
hold on
plot(idiff_pc,'s-r');
% plot(diff2,'.-k');
legend(...
    'real diff',...
    'imag diff');
xlabel('NumCarriers');
ylabel('relative difference in %');
hold off

%-- Compare
result = ( abs(diff)>8);
ModuleName='EQZF';
if any([result ])
    disp(['Error: MEX function ' ModuleName ' failed.' ]);
    status = -1 ;
else
    disp(['OK: MEX function ' ModuleName ' succeeded' ]);
    status = 1;
end

rmpath('../');
rmpath('../../../../../../../Manager/CM/Utilities/matlab');

⌨️ 快捷键说明

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