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

📄 test_fpfft.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: test_fpfft.m.rca $
%  Tag $Name:  $
%  $Revision: 1.2 $
%  $Date: Mon Dec 11 12:04:36 2006 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function status = test_fpfft

disp('%-- Test of MEX FFT --%')

%-- Add path for mGetBin.m,dll and test vectors
addpath('../../../../../FP/CM/Utilities/matlab');
addpath('../')
addpath('./vectors_fpfft')
addpath('./vectors_fpifft')


%-- Find here the test vectors used
% Note:
% TV 1 and 2 should provide exact result, but I don't have exact for TV1
% for some unknow reasons, I guess because I don't apply the right scaling
% TV3 is a TV from ifft and of course, you don't go back exactly to your
% staring point (this vector has no noise in it, as you can see by using a
% "hist".

TVNames = { 'input_fft512.bin'  'input_fft1024.bin'             'output_ifft1024_up16_ref.bin'; ...
    'output_fft512_ref.bin'     'output_fft1024_down16_ref.bin' 'input_ifft1024.bin'   };

%-- Scaling used (hex)
Scaling = [  hex2dec('00008008') hex2dec('80008000') hex2dec('00088000') ];
%-- Additionnal Scaling (optional parameter)
additionnalScaling = [2^-3 1  2];


r=zeros(1024,2);
for i=2 %1:size(TVNames,2)  %only TV2 provides exact output

    disp(['test vector: ' TVNames{1,i} ])

    %-- Get stimuli
    Vin= mGetBin(TVNames{1,i},'int16','1R1I');
    Vin = double(Vin);

    %-- Get ref
    ref= mGetBin(TVNames{2,i},'int16','1R1I');
    ref=double(ref);

    %-- Calling the dll
    [fftVout, scale ] = fpfft(Vin,Scaling(1,i),additionnalScaling(i));
    
    %-- Some Display in Command Window
    disp(['Scaling used: ' dec2hex(scale) '.' ])
    ratio = ref./fftVout; %degugging purpose
    diff_fft=(fftVout-ref);
    s(i)=sum(diff_fft);
    disp(['  total differences: ' int2str(abs(s(i))) ])
    r(1:size(fftVout,1),i)=real(fftVout)./real(ref);%degugging purpose

%     figure(1);
%     plot(real(r(:,i)))

    [Sfftr(i),Imax]=max(abs(real(diff_fft)));
    disp(['  => max absolute real difference between mex fft(vin)  and ref: ' int2str(Sfftr(i)) '.' ])
    disp(['  fftVout(' int2str(Imax) ')=' int2str(fftVout(Imax)) ' and ' ...
        'ref(' int2str(Imax) ')=' int2str(ref(Imax)) ])

    [Sffti(i),Imax]=max(abs(imag(diff_fft)));
    disp(['  => max absolute imag difference between mex fft(vin)  and ref: ' int2str(Sffti(i)) '.' ])
    disp(['  fftVout(' int2str(Imax) ')=' int2str(imag(fftVout(Imax))) ' and ' ...
        'ref(' int2str(Imax) ')=' int2str(imag(ref(Imax))) ])
    disp([' ']);


%     figure(2);
%     hist(real(Vin))
%     figure(3);
%     hist(real(ref))
%     figure(4);
%     hist(real(fftVout))
%     figure(5);
%     plot(real(Vin))


end

disp('  ***************************');
if sum(s)==0
    disp(['  *** TEST FPFFT PASSED  ***' ])
    status =1 ;
else
    disp(['  *** TEST FPFFT FAILLED ***' ])
    status = -1 ;
end
disp('  ***************************');
disp('%-- End of Test of MEX FFT --%')


%-- Remove paths
rmpath('../../../../../FP/CM/Utilities/matlab');
rmpath('../')
rmpath('./vectors_fpfft')
rmpath('./vectors_fpifft')




⌨️ 快捷键说明

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