?? sigcomp2.m
字號:
function sigOut = sigcomp2(sigIn, calFile, calMethod, calAngle, nearfieldMethod, nearfieldAnlge)%SIGCOMP2 Performs calibration compensation on the signals for the AIMT experimental antenna.%%--------%Synopsis:% sigOut = sigcomp2(sigIn, calFile, calMethod, calAngle,% nearfieldMethod, nearfieldAnlge)%%Description:% Performs calibration compensation on the signals using information from% the file "calFile". Two independent compensations can be choosen to be% done or not done: Coupling and nearfield. For more information about% the compensations, see [2].%% Calibration compensation for coupling and near field can also be performed% on the steering vectors with the function "setcal1". Make sure that% compensation of coupling and/or near field is not done both with "setcal1"% and "sigcomp2".%% NOTE: Before this function can be executed, the function "setcal1" with% the correct calibration file name must be executed.%%Output and Input:% calFile (StringT): Name of file with calibration compensation information.% It normally ends with ".dbc".% calMethod [D](StringT): Coupling compensation to be done.% = 'Ccmp': Use decoupling matrix (default).% = 'wctab': Use a table of corrections for different directions.% Not implemented.% = 'wcmedel': Ask Lars Pettersson, FOA.% = 'nocomp': No compensation will be used.% calAngle [D](RealScalarT): Angle to use in the table of corrections.% Only applicable for calMethod = 'wctab'. Default value is 0.% NOTE: Not implemented yet.% nearfieldMethod [D](StringT)% = 'nearfldcomp': Nearfield compensation will be done.% = 'nocomp': No nearfield compensation (default).% nearfieldAnlge [D](RealScalarT): Angle to use for nearfield compensation.% Default value is 0.%%Global Variables:% global c0 xel Rmeas deltaz0 dxel0 th3dBV fRFth3dBV dipl nely hel% (in eincdbt).%%--------%Notations:% Data type names are shown in parentheses and they start with a capital% letter and end with a capital T. Data type definitions can be found in [1]% or by "help dbtdata".% [D] = This parameter can be omitted and then a default value is used.% When the [D]-input parameter is not the last used in the call, it must be% given the value [], i.e. an empty matrix.% ... = There can be more parameters. They are explained under respective% metod or choice.%%Examples:% % Set calibration method and factors.% dataFileName = 'datafil1';% if (strcmp(methodCh,'rmusic') | strcmp(methodCh,'esprit'))% setcal1('nocomp',[dataFileName, '.dbc'],'nocomp')% sig = sigcomp2(sig, [dataFileName, '.dbc'], 'Ccmp', [], 'nearfldcomp');% else % setcal1('wctab',[dataFileName, '.dbc'], 'nearfldcomp')% end%if%%Software Quality:% (About what is done to ascertain software quality. What tests are done.)%%Known Bugs:% The signal is not marked as "compensated". Should it be that?%%References:% [1]: Bj鰎klund S.: "DBT, A MATLAB Toolbox for Radar Signal Processing.% Reference Guide", FOA-D--9x-00xxx-408--SE, To be published.% [2]: Pettersson L.: "講ersiktlig beskrivning av m鋞dataanalysprogram f鰎% digital experimentantenn", FOA-D--96-00226-3.2--SE, FOA February 1996.%%See also:% setcal1, dbtex10, dbtex9, expsig1% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 970903 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:21:40 $ $Author: svabj $.% $Revision: 1.23 $% *****************************************************************************%Possible extensions in the code:%% = 'wctab': Use a table of corrections for different directions.% Not implemented.% size(Cmat) =% 321 12% Probably what it missing is that we have to look up in the table for exactly one angle, namely calAngle.% ----------------------------------------------------------------------- %% Handle input parameters.% ----------------------------------------------------------------------- %if (nargin < 1) error('DBT-Error: To few input parameters.')end% ****************** Add missing input parameters ******************if (nargin < 3) calMethod = [];endif (nargin < 4) calAngle = [];endif (nargin < 5) nearfieldMethod = [];endif (nargin < 6) nearfieldAnlge = [];end%if (nargin < 7)% rangeIx = [];%end%if (nargin < 8)% trialIx = [];%end% ****************** Default values ******************if isempty(calMethod) calMethod = 'Ccmp';end%ifif isempty(calAngle) calAngle = 0;end%ifif isempty(nearfieldMethod) nearfieldMethod = 'nocomp';end%ifif isempty(nearfieldAnlge) nearfieldAnlge = 0;end%if%if isempty(rangeIx)% rangeIx = 1;%end%if%if isempty(trialIx)% trialIx = 1;%end%if% ****************** Error check input parameters ******************chkdtype(sigIn, 'RxCompSigT', 'RxRadarSigT')chkdtype(calFile, 'StringT')chkdtype(calMethod, 'StringT')chkdtype(calAngle, 'RealScalarT')chkdtype(nearfieldMethod, 'StringT')chkdtype(nearfieldAnlge, 'RealScalarT')%chkdtype(rangeIx, 'IndexT')%chkdtype(trialIx, 'IndexT')%sizeSig = sigsize(sigIn,[],'n');%if (sizeSig(1,2) > 1)% fprintf('\nWarning: Only one range bin is implemented in sigcomp2. Using index = 1.\n\n')%end%if (sizeSig(1,5) > 1)% fprintf('\nWarning: Only one trial is implemented in sigcomp2. Using index = 1.\n\n')%end% ****************** Pick out fields from input parameters. ******************% The two-dimensional matrix with the received antenna signals is in% the matrix X. X is of size (number of channels) x (number of snapshots).signals = sigIn.signals;% *********** Read calibration compensation information from file. ***********global exp2dbtversion c0 xel Rmeas deltaz0 dxel0 th3dBV fRFth3dBV diplglobal nely hel Ccmpfile Wcmpfile Ccmp wctab wcmedel wcmat sphitab % The calibration information must be stored in global variables for % other functions to work.exp2dbtversion = matgetm(calFile,'exp2dbtversion');if ((exp2dbtversion == 2) | (exp2dbtversion == 3)) %global c0 xel Rmeas deltaz0 dxel0 th3dBV fRFth3dBV dipl nely hel %global Ccmp wctab phitab wcmedel wcmat Ccmpfile Wcmpfile %global cmpmetLocal load(calFile,'-mat') Ccmp = Ccmp / norm(Ccmp,'fro'); % Normalizing the decupling matrix. phitab = asin(sphitab); cmpmetLocal = calMethod;else error('DBT-Error: Wrong version of the file ',calFile)end%if% ----------------------------------------------------------------------- %% Get calibration information.% ----------------------------------------------------------------------- %%global cmpmetLocal%global Ccmp wctab phitab wcmedel wcmat%global c0cmpmet = cmpmetLocal;if strcmp(cmpmet,'wctab') Cmat = wctab;elseif strcmp(cmpmet,'Ccmp') Cmat = Ccmp;elseif strcmp(cmpmet,'wcmedel') Cmat = wcmedel;elseif strcmp(cmpmet,'nocomp') % Do nothing. I do have to assign a value to Cmat, don't I? Cmat = [];else error('DBT-Error: Wrong calMethod in sigcomp2.');end%ifif strcmp(nearfieldMethod,'nearfldcomp') %ant = sigIn.antenna; %lambda = ant.lambda; waveform = sigIn.waveform; lambda = waveform.wavelength; frequencyMhz = (c0/lambda)*1e-6; wnfcmp=eincdbt(nearfieldAnlge,frequencyMhz,'nearfield');elseif strcmp(nearfieldMethod,'nocomp') wnfcmp=[];else error('DBT-Error: Wrong nearfieldMethod in sigcomp2.');end% ----------------------------------------------------------------------- %% Do the calibration compensation.% ----------------------------------------------------------------------- %sizeSig = sizem(signals);noTrial = sizeSig(5);noRange = sizeSig(2);for nTrial = 1:noTrial; for nRange = 1:noRange; X = (getm3(signals,3,1, ':',nRange,':',1,nTrial)); X = vcorrdbt(X.',Cmat,cmpmet,wcmat,wnfcmp).'; signals(':',nRange,':',1,nTrial) = X.'; % Test of change to Matlab 5 indexing instead of setm: %>> all(all(all((sig10.signals == sig12.signals),1),2),3) % ans = % 1 infoStr = sprintf('sigcomp2: trial = %d(%d), range = %d(%d)\r',... nTrial,noTrial, nRange,noRange); dbtinfo(infoStr,1); end%for nRangeend%for nTrialdbtinfo(''); %New line.% ----------------------------------------------------------------------- %% Return data.% ----------------------------------------------------------------------- %sigOut = sigIn;sigOut.signals = signals;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -