📄 normsig.m
字号:
function sigOut = normsig(sigIn, method, noSrc, checkParamFlag)%NORMSIG Normalizes a radar signal or a spatial correlation matrix relative the noise power.%%--------%Synopsis:% sigOut = normsig(sigIn)% sigOut = normsig(sigIn,[],noSrc)%%Description:% Normalizes a radar signal (RxRadarSigT) or a spatial correlation matrix % (RxCorrMatT) relativ the noise power for each trial, cpi, and range.% The noise power is estimated as the mean value of the smallest eigenvalues % (the noise eigenvalues) of the spatial correlation matrix.%% For radar signals, the same normalization constant is applied to all% channels and all pulses.%%Output and Input:% sigOut (RxRadarSigT) : Radar signal after normalization.% If the input parameter is of type RxRadarSigT so will this output be.% sigOut (RxCorrMatT) : Spatial correlation matrix after normalization.% If the input parameter is of type RxCorrMatT so will this output be.%% sigIn (RxRadarSigT) : Radar signal before normalization.% sigIn (RxCorrMatT) : Spatial correlation matrix before normalization.% noSrc [D](IntScalarT): Number of signal sources. This means that there% are ((number-of-channels) - noSrc) noise eigenvalues. If this value% is too low, the estimated noise power will be somewhat too low. If% this value is too high, the estimated noise power will be too high% (maybe much too high). Default value is = 1, which means that only the% smallest eigenvalue is used.% checkParamFlag [D] (BoolT): 0 = Do not check data types of input parameters.% 1 = Check data types of input parameters (default).%%--------%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.)%%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.%%See Also:% basecorrm, ecorrm% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 990504 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:21:13 $ $Author: svabj $.% $Revision: 1.9 $% *****************************************************************************% ----------------------------------------------------------------------- %% Handle input parameters% ----------------------------------------------------------------------- %arginNo=1;if (nargin < arginNo) error('DBT-Error: To few input parameters.')endarginNo = arginNo +1;% ****************** Add missing input parameters ******************if (nargin < arginNo) method = [];endarginNo = arginNo +1;if (nargin < arginNo) noSrc = [];endarginNo = arginNo +1;if (nargin < arginNo) checkParamFlag = [];endarginNo = arginNo +1;% ****************** Default values ******************if isempty(method) method = [];end%ifif isempty(noSrc) noSrc = [];end%ifif isempty(checkParamFlag) checkParamFlag = 1;end%if% ****************** Error check input parameters ******************if (checkParamFlag) chkdtype(sigIn, 'RxRadarSigT','RxCorrMatT')end%if% ****************** Create output variable ******************sigOut = sigIn;% ----------------------------------------------------------------------- %% RxRadarSigT: Radar signals.% ----------------------------------------------------------------------- %if (strcmp(sigIn.dataType,'RxRadarSigT')) % ****************** Signal size ****************** sizeSpec = sizem(sigIn.signals); noPulses = sizeSpec(1); noRanges = sizeSpec(2); noChannels = sizeSpec(3); noExtras = sizeSpec(4); noCPIs = sizeSpec(5); noTrials = sizeSpec(6); if isempty(noSrc) noSrc = noChannels-1; % Default value: use only the smallest eigenvalue. end%if % ****************** Loops ****************** for trialLoop = 1:noTrials for cpiLoop = 1:noCPIs for extraLoop = 1:noExtras for rangeLoop = 1:noRanges %sigMat=sigIn.signals(:,rangeLoop, :, extraLoop, cpiLoop, trialLoop); sigMat = getm3(sigIn.signals, 3, [], ':',rangeLoop, ':', ... extraLoop, cpiLoop, trialLoop); corrMatMx = (1/noPulses) * sigMat*sigMat'; % Estimate spatial correlation matrix. Use all pulses as samples. eigVals = (flipud(sort(abs(eig(corrMatMx))))); % Calculate eigenvalues of the spatial correlation matrix. %noisePower = eigVals(noChannels); noisePower = mean(eigVals(noSrc+1:noChannels)); % Choose the mean value of the smallest eigenvalues as an % estimate of the noise power. sigOut.signals(:,rangeLoop,:,extraLoop,cpiLoop,... trialLoop) = sigOut.signals(:,rangeLoop,:,extraLoop,cpiLoop,... trialLoop) / sqrt(noisePower); % Normalize the signal to the noise amplitude. end%for rangeLoop end%for extraLoop infoStr = sprintf('normsig: cpiLoop = %d(%d), rangeLoop = %d(%d)\r',... cpiLoop, noCPIs, rangeLoop, noRanges); dbtinfo(infoStr,1); end%for cpiLoop dbtinfo(''); %New line. end%for trialLoop% ----------------------------------------------------------------------- %% RxCorrMatT: Correlation matrices.% ----------------------------------------------------------------------- %elseif (strcmp(sigIn.dataType,'RxCorrMatT')) % ****************** Correlation matrix size ****************** sizeSpec = sizem(sigIn.corrMat); noChannels = sizeSpec(1); %noPulses = 1; % Can only store correlation matrix for a single pulse in RxCorrMatT data % type. noRanges = sizeSpec(3); noExtras = sizeSpec(4); noCPIs = sizeSpec(5); noTrials = 1; % Can only store correlation matrix for a single trial in RxCorrMatT data % type. if isempty(noSrc) noSrc = noChannels-1; % Default value: use only the smallest eigenvalue. end%if % ****************** Loops ****************** for trialLoop = 1:noTrials for cpiLoop = 1:noCPIs for extraLoop = 1:noExtras for rangeLoop = 1:noRanges corrMatMx = sigIn.corrMat(:,:,rangeLoop, extraLoop, cpiLoop); [U,S,V] = svd(corrMatMx); % Calculate eigenvalues of the spatial correlation matrix. eigVals = diag(S); noisePower = mean(eigVals(noSrc+1:noChannels)); % Choose the mean value of the smallest eigenvalues as an % estimate of the noise power. %eigVals = eigVals / (noisePower); %corrMatMx = U*diag(eigVals)*V'; corrMatMx = corrMatMx ./ (noisePower); % Normalize the correlation matrix to the noise power. % This could also be done by: corrMatMx = corrMatMx ./ noisePower; sigOut.corrMat(:,:,rangeLoop, extraLoop, cpiLoop) = corrMatMx; end%for rangeLoop end%for extraLoop infoStr = sprintf('normsig: cpiLoop = %d(%d), rangeLoop = %d(%d)\r',... cpiLoop, noCPIs, rangeLoop, noRanges); dbtinfo(infoStr,1); end%for cpiLoop dbtinfo(''); %New line. end%for trialLoopelse error('DBT-Error: Illegal datatype of input parameter "inData".')end%if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -