📄 calcfiltinit.m
字号:
arginNo = arginNo +1;if (nargin < arginNo) orthBeamFlag = [];endarginNo = arginNo +1;if (nargin < arginNo) extraParam = [];endarginNo = arginNo +1;if (nargin < arginNo) normType = [];endarginNo = arginNo +1;% ****************** Default values ******************sigVectLen = sizeSigIn(1);noSamples = sizeSigIn(2);if isempty(taperCoeff) taperCoeff = ones(sigVectLen,1); taperCoeff = [];end%ifif isempty(interCorrMat) %interCorrMat = eye(sigVectLen); interCorrMat = [];end%ifif isempty(orthBeamFlag) orthBeamFlag = 0;end%ifif isempty(extraParam) extraParam = [];end%ifif isempty(normType) normType = 'noNorm';end%if% ************* Pick out some more fields from input parameters. *************% ****************** Error check input parameters ******************%chkdtype(sigMatIn, 'CxMatrixT')chkdtype(method, 'StringT')chkdtype(steMat, 'CxMatrixT')chkdtype(taperCoeff, 'CxVectorT')chkdtype(interCorrMat, 'CxMatrixT', 'EmptyT')% ----------------------------------------------------------------------- %% Loops for several range gates and trials.% ----------------------------------------------------------------------- %% ****************** Create output variable. ******************basisMat = eye(sigVectLen); % ----------------------------------------------------------------------- % % Code common to all methods. % ----------------------------------------------------------------------- % % **************** Pick out fields from input parameters. **************** % ****************** Precalculations. ****************** if (strcmp(method,'cbf') | strcmp(method,'acbf')) method = 'atfir'; end%if if (strcmp(method,'conv') | strcmp(method,'aconv')) method = 'atfir'; end%if % ----------------------------------------------------------------------- % % Methods % ----------------------------------------------------------------------- % % ----------------------------------------------------------------------- % % Adaptive Total Finite Response Filter (Adaptive Conventional Beamforming) % % Start: 981013 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % if (strcmp(method,'atfir')) aModel = steMat; % The signal according to the used signal model. sd = dotapering(aModel, taperCoeff); % Desired responses including tapering. if (~isempty(interCorrMat)) W = inv(interCorrMat) * sd; % Filtering weights including side lobe cancellation. else W = sd; end%if if (orthBeamFlag), W = orthbeam(W); end%if basisMat = W; weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % Total Finite Response Filter (Conventional beamforming). % % Start: 98xxxx NN NN (uuuu). % ----------------------------------------------------------------------- % elseif (strcmp(method,'tfir')) % ----------------------------------------------------------------------- % % Capons Method. % % Start: 981013 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'capon')) basisMat = steMat; weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % Generalized Constrained Adaptive Array Processor ([2] p. 355). % % Start: 981122 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'gcaap')) if isempty(extraParam) extraParam = []; % Should be a suitable default value. end%if ConstraintMatrix = extraParam{1}; ConstraintValues = extraParam{2}; % W = ...if (0) sigCorrMat = (1/noSamples) * sigMatIn*sigMatIn'; invSigCorrMat = inv(sigCorrMat); normFactors = 1 ./ diag(steMat' * invSigCorrMat * steMat); W = (invSigCorrMat * steMat) * diag(normFactors); if (orthBeamFlag), W = orthbeam(W); end%if %sigMatOut = W' * sigMatIn; basisMat = W; weightMatrix = basisMat; %freqPos = ...end%if (0) % ----------------------------------------------------------------------- % % Discrete Fourier Transform Method. % % Start: 981013 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'fft')) if isempty(extraParam) extraParam = sigVectLen; end%if noPulses = sigVectLen; noDopChan = extraParam; basisMat = fftshift1(dftopm(noDopChan,noPulses)'); weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % Inverse Discrete Fourier Transform Method. % % The implementation is not finnished. % % Start: 98xxxx Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'ifft')) if isempty(extraParam) extraParam = sigVectLen; end%if noPulses = extraParam; noDopChan = sigVectLen; if (0) %Most is done in "calcfiltproc". if isempty(extraParam) extraParam = size(sigMatIn,1); end%if noPulses = extraParam; noDopChan = size(sigMatIn,1); sigMatIn = diag(taperCoeff) * sigMatIn; % The beams in IFFT are always orthogonal. No need for an explicit % orthogonalization. sigMatOut = fftshift1(ifft(sigMatIn, noPulses),'inv'); end%if (0) %basisMat = fftshift1(dftopm(noDopChan,noPulses)'); % The inverse discrete Fourier transform matrix should be % Bi = conj(dftopm(N,N))/N, see function "dftopm". weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % Direct Transformation Matrix Method. % (Direct beamforming weight multiplication) % % Start: 981013 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'trans')) if (0) transMat = steMat; sigMatIn = diag(taperCoeff) * sigMatIn; % Shouldn't it be "transMat" % instead of "sigMatIn" ? if (orthBeamFlag), transMat = orthbeam(transMat); end%if sigMatOut = transMat' * sigMatIn; end%if (0) basisMat = steMat; weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % SB Interference Eigenvector Method. % (Using the eigenvectors as weights) % % Implementation is not finnished. % % Start: 991017 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'intereigvec')) [U,S,V]=svd(interCorrMat); % Eigendecomp. of correlation matrix using SVD. basisMat = U; weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % SB Data Eigenvector Method. % (Using the eigenvectors as weights) % % Implementation is not finnished. % % Start: 991017 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'dataeigvec')) % The calculation is the same as in 'intereigvec' but the correlation % matrix is formed from the signal samples in "calcfiltproc". % This beamforming should result in beams formed in that way that the % eigenvalues of the correlation matrix is the power received through % the beams. basisMat = steMat; weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % MUSIC. % % Note, this method is non-linear. Other linear processing cannot be % performed after this method. This method should be in the function % "calcspcproc" instead. % % Start: 990307 Svante Bj鰎klund (svabj). % ----------------------------------------------------------------------- % elseif (strcmp(method,'music')) basisMat = steMat; weightMatrix = basisMat; %freqPos = ... % ----------------------------------------------------------------------- % % % ----------------------------------------------------------------------- % elseif (strcmp(method,'dummy')) % ----------------------------------------------------------------------- % % The else branch. % ----------------------------------------------------------------------- % else fprintf('Selected filter method = %s.\n',method) error('DBT-Error: Selected filter method is not implemented.') end%if % ----------------------------------------------------------------------- % % Normalization of the weights. % ----------------------------------------------------------------------- % if (strcmp(normType,'noNorm')) % Do nothing. elseif (strcmp(normType,'someNorm')) %normOfWeights = %weightMatrix = (1/normOfWeights) * weightMatrix; else fprintf('Selected normalization type = %s.\n',normType) error('DBT-Error: Selected normalization type is not implemented.') end%if % ----------------------------------------------------------------------- % % Return data. % ----------------------------------------------------------------------- %methodCalc = method;freqPos = [];%endfunction calcfiltinitfunction matrixOut = dotapering(matrixIn, taperCoeff) if (~isempty(taperCoeff)) if (issparse(matrixIn)) lenTap = length(taperCoeff); taperCoeffMatrix = spdiags(taperCoeff, 0, lenTap, lenTap); else taperCoeffMatrix = diag(taperCoeff); end%if matrixOut = taperCoeffMatrix * matrixIn; else matrixOut = matrixIn; end%if%endfunction dotapering
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -