📄 spanosrc.m
字号:
function noSrc = spanosrc(sigIn, method, rangeIx, trialIx, param1, param2, param3)%SPANOSRC Estimate the number of signal sources using spatial information.%%--------%Synopsis:% noSrc = spanosrc(sigIn, method, rangeIx, trialIx, ...)%%Description:% Estimate the number of signal sources using spatial information.%%Output and Input:% noSrc (IntMultiMatrixT): Estimated number of signals.% sigIn (RxRadarSigT or RxCorrMatT): The input antenna signal or a% spatial correlation matrix.% method (StringT): Estimation method. See below for sections about each% method.% = 'aic': An Information Criterion (AIC).% = 'mdl': Minimum Description Length (MDL).% = 'amir': See DOAPEAK below.% = 'amirbin': See DOAPEAK below.% = 'MA1': See DOAPEAK below.% = 'fam': See DOAPEAK below.% = 'smlglrt': Generalized Stochastic Likelihood Ratio Test Detection Scheme% ([2] p. 133-136). Not implemented.% = 'wsf': Weighted Subspace Detection Scheme ([2] p. 133-136).% Not implemented.% rangeIx [D](IntScalarT): Indices of range bin (default = 1). Only used% when "signals" is of type RxRadarSigT.% trialIx [D](IntScalarT): Trial indices (default = 1). Only used% when "signals" is of type RxRadarSigT.%%--------%AIC.%Synopsis:% noSrc = spanosrc(sigIn, 'aic')% noSrc = spanosrc(sigIn, 'aic', [], [], plotOpt)% noSrc = spanosrc(sigIn, 'aic', rangeIx, trialIx, plotOpt)%%Output and Input:% plotOpt (StringT): Plot option.% = 'plot': Plots a bar plot of the AIC function.%%Description:% Estimates the number of signals using An Information Criterion (AIC).%%Algoritm:%%--------%MDL.%Synopsis:% noSrc = spanosrc(sigIn, 'mdl')% noSrc = spanosrc(sigIn, 'mdl', [], [], plotOpt)% noSrc = spanosrc(sigIn, 'mdl', rangeIx, trialIx, plotOpt)%%Output and Input:% plotOpt (StringT): Plot option.% = 'plot': Plots a bar plot of the AIC function.%%Description:% Estimates the number of signals using Minimum Description Length (MDL).%%Algoritm:%%--------%DOAPEAK%Synopsis:% noSrc = spanosrc(sigIn, method, rangeIx, trialIx, guessNoSrc, smplPoints)%%Description:% Uses MUSIC to generate a DOA spectrum, in which the function "doapeak"% estimates the number of sources. All methods in "doapeak" can be used.%%Output and Input:% method (StringT): Any of the methods in the function "doapeak".% guessNoSrc [D](IntScalarT): ?% smplPoints [D](Vector of DoaT): Calculate the spectrum at these angles.%%Algoritm:%%--------%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:%%Software Quality:% (About what is done to ascertain software quality. What tests are done.)% This function is not tested yet.%%Known Bugs:%%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]: Haykin S., Litva J., Shepherd T.J.(Eds.):"Radar Array Processing",% Springer Verlag 1993, ISBN 3-540-55224-3, 0-387-55224-3. p. 133-136.%%See Also:% doapeak% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 981112 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:21:59 $ $Author: svabj $.% $Revision: 1.7 $% *****************************************************************************% ----------------------------------------------------------------------- %% Handle input parameters% ----------------------------------------------------------------------- %if (nargin < 1) error('DBT-Error: To few input parameters.')end% ****************** Add missing input parameters ******************arginNo=2;if (nargin < arginNo) method = [];endarginNo = arginNo +1;if (nargin < arginNo) rangeIx = [];endarginNo = arginNo +1;if (nargin < arginNo) trialIx = [];endarginNo = arginNo +1;if (nargin < arginNo) param1 = [];endarginNo = arginNo +1;if (nargin < arginNo) param2 = [];endarginNo = arginNo +1;if (nargin < arginNo) param3 = [];endarginNo = arginNo +1;if (0)% *************** Evalute the list extraParam of keywords ***************% These the value of this keywords are assigned to the local variables with% the same name as the keywords. The use of keywords is to make calls to% this function simpler.if (nargin >= arginNo) lenExtra = length(extraParam); if (mod(lenExtra,2) ~= 0), error('DBT-Error: Value missing.'),end%if for n = 1:2:length(extraParam) eval([extraParam{n} '= extraParam{n+1};' ]); end%for nendarginNo = arginNo +1;end%if (0)% ****************** Default values ******************if isempty(method) method = 'aic';end%ifif isempty(rangeIx) rangeIx = 1;end%ifif isempty(trialIx) trialIx = 1;end%ifif isempty(param1) param1 = [];end%ifif isempty(param2) param2 = [];end%ifif isempty(param3) param3 = [];end%if% ************* Pick out some more fields from input parameters. *************% ****************** Error check input parameters ******************chkdtype(sigIn, 'RxRadarSigT','RxCorrMatT')chkdtype(method, 'StringT')% ----------------------------------------------------------------------- %% Loops for several range gates and trials.% ----------------------------------------------------------------------- %% ****************** Create output variable. ******************noSrc = zeros([length(rangeIx), 1, length(trialIx)]);%size(noSrc)% ****************** Loops. ******************noTrials = length(trialIx);noRanges = length(rangeIx);for trialLoop = 1:noTrialsfor rangeLoop = 1:noRanges % ----------------------------------------------------------------------- % % Code common to all methods. % ----------------------------------------------------------------------- % % ****************** Pick out fields from input parameters. ***************** Rxx1 = ecorrm(sigIn, [], rangeIx(rangeLoop), trialIx(trialLoop)); Rxx = Rxx1.corrMat; % Get a antenna signal correlation matrix. antenna = sigIn.antenna; noChan = antenna.noElem; % Number of channels. %waveform = sigIn.waveform; %lambda = waveform.wavelength; % ****************** Precalculations. ****************** %noDoas = size(smplPoints,2); % Number of points to calculate the spectrum in. %pointSubDoa = 0; %A = spastemat(antenna,smplPoints,lambda,focusDist,pointSubDoa); %Pspect = zeros(noDoas,1); % ----------------------------------------------------------------------- % % Methods % ----------------------------------------------------------------------- % % ----------------------------------------------------------------------- % % AIC % % Start: 961120 Fredrik Athley (freath). % ----------------------------------------------------------------------- % if (strcmp(method,'aic')) noSrc1 = aic(Rxx1,param1); % ----------------------------------------------------------------------- % % MDL % % Start: 961120 Fredrik Athley (freath). % ----------------------------------------------------------------------- % elseif (strcmp(method,'mdl')) noSrc1 = mdl(Rxx1,param1);if (0)% This implementation is not finnished yet. % ----------------------------------------------------------------------- % % Generalized Stochasic Likelihood Ratio Test Detection Scheme. % % (Reference [2] p. 133-136) % % Start: 981122 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'smlglrt')) noSamples = [] % Should be assigned to a suitable value. noChan = [] % Should be assigned to a suitable value. threshold = [] % Should be assigned to a suitable value. noSrcHyp = 0; readyLoop = 0; while (~readyLoop) Vsml = [] % Should be assigned to a suitable value. Rhat = [] % Should be assigned to a suitable value. contCriterion = (2*noSamples*(Vsml-log(det(Rhat))) > threshold); if (contCriterion) noSrcHyp = noSrcHyp + 1; elseif (noSrcHyp > 2*noChan) noSrcHyp = 0; readyLoop = 1; else readyLoop = 1; end%if end%while noSrc = noSrcHyp; % ----------------------------------------------------------------------- % % Weighted Subspace Detection Scheme. % % (Reference [2] p. 133-136). % % Start: . % ----------------------------------------------------------------------- % elseif (strcmp(method,'wsf'))end%if (0) % ----------------------------------------------------------------------- % % XXXXX % % Start: . % ----------------------------------------------------------------------- % elseif (strcmp(method,'xxxx')) % ----------------------------------------------------------------------- % % % ----------------------------------------------------------------------- % elseif (strcmp(method,'dummy')) % ----------------------------------------------------------------------- % % The else branch. % ----------------------------------------------------------------------- % else if (isempty(param1)) guessNoSrc = max(fix(noChan/2), noChan-4); else guessNoSrc = param1; end%if smplPoints = param2; spect1 = sdoaspc('music',sigIn,smplPoints,guessNoSrc); [edoa, noSrc1] = doapeak(spect1, method, guessNoSrc); end%if % ----------------------------------------------------------------------- % % Return data. % ----------------------------------------------------------------------- % %rangeIx(rangeLoop) infoStr = sprintf('spanosrc: trial = %d(%d), range = %d(%d)\r',trialLoop, noTrials, rangeLoop, noRanges); dbtinfo(infoStr,1); noSrc(rangeLoop, 1, trialLoop) = noSrc1;end%for rangeLoopend%for trialLoopdbtinfo(''); %New line.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -