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

📄 test_demodmappercompare.m

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

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


function status = test_DemodMapperCompare(seed)

if (exist('seed','var') == 0)
    seed = sum(100*clock);
end
rand('state',seed);
warning off
status(1) = test_DemodMapperCompareSeed(2,seed);
status(2) = test_DemodMapperCompareSeed(4,seed);
status(3) = test_DemodMapperCompareSeed(6,seed);
warning on

if any(status~=1);
    status = -1 ;
else
    status = 1;
end



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%-- Function based on ModeType
function status = test_DemodMapperCompareSeed(ModeType,seed)

clear global
clear functions
close all

profile off

addpath('../');
addpath('../../../../../../../SP/CM/matlab');

if (ModeType == 2)
    modename = 'QPSK';
end
if (ModeType == 4)
    modename = '16QAM';
end
if (ModeType == 6)
    modename = '64QAM';
end

disp([ 'Testing DemodMapper with ModeType = ' modename   ]);

dataSize = 48;
fname = 'DemodMapper';
Q = 15;

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

[mOut_fixed mBlkSize]= mDemodMapper(In_fixed,length(In_fixed),ModeType,'y');
mOut_fixed = int8(mOut_fixed);
mOut_fixed = double(mOut_fixed);

[fpOut_fixed fpBlkSize]= DemodMapper(In_fixed_adjusted,length(In_fixed_adjusted),ModeType,'y');
[mOut_fixed(1:10) fpOut_fixed(1:10)];


%-- display results
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff = (mOut_fixed - fpOut_fixed);
diff(1:5)';
disp( ['max(abs(real(diff))) = ' num2str(max(abs(real(diff))))]);
diff2 = double(mOut_fixed - fpOut_fixed)./abs(max(double(fpOut_fixed),double(mOut_fixed)));

diff_pc = diff2.*100;
diff2(1:5)';
rdiff_pc=real(diff_pc);
disp( ['max(abs(rdiff_pc)) = ' num2str(max(abs(rdiff_pc))) ' %.']);
figure(1)
plot(rdiff_pc,'^-b');
hold on
legend(...
    'real diff' ...
    );
xlabel('NumCarriers');
ylabel('relative difference in %');
hold off

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


rmpath('../');
rmpath('../../../../../../../SP/CM/matlab');

⌨️ 快捷键说明

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