📄 ranfilt.m
字号:
% ****************** Default values ******************if isempty(method) method = 'aconv';end%ifif isempty(model) model = {sigIn.antenna, sigIn.waveform};end%ifantenna = model{1};waveform = model{2};noChannels = waveform.noRangeBins; % Number of input channels or samples in the dimension we are filtering. % NFF: Choose the size of the right dimension.tempModelParam = {[] [] [] []}; % NFF: Change to suitable default values.if isempty(modelParam) modelParam = tempModelParam;else tempModelParam(1:length(modelParam)) = modelParam; modelParam = tempModelParam;end%ifpropSpeed = modelParam{1};if isempty(propSpeed) propSpeed = speedoflight;end%ifinterpMethod = modelParam{2};if isempty(interpMethod) interpMethod = [];end%ifstorageClass = modelParam{3};if isempty(storageClass) storageClass = [];end%ifboundaryMethod= modelParam{4};if isempty(boundaryMethod) boundaryMethod = [];end%if% NFF: Change to a suitable default values above.if isempty(rangeChoice) %ranBinLen = (propSpeed * waveform.sampleTime)/2; ranBinLen = getranbinlen(waveform, propSpeed); %fprintf('ranfilt line about 243.') rangeChoice = (0.5 : (waveform.noRangeBins - 0.5)) * ranBinLen; rangeChoice = (sigIn.ranIx - 0.5) * (ranBinLen); % The center range in meter in each range bin. % NFF: Change to a suitable default value for "rangeChoice".end%ifif isempty(taperCoeff) taperCoeff = [];end%ifif isempty(interCorrMat) interCorrMat = [];end%ifif isempty(steVecFlag) steVecFlag = 1;end%ifif isempty(extraParam) extraParam = [];end%ifif isempty(orthBeamFlag) orthBeamFlag = 0;end%if% ************ Add missing input parameters in "xxx" ************% ****************** Default values in "xxx" ******************% ************* Pick out some more fields from input parameters. *************%lambda = waveform.wavelength(1);%if (length(waveform.wavelength) > 1)% error('DBT-Error: Can only handle one wavelength.')%end%if%lambda = waveform.wavelength;% ****************** Error check input parameters ******************chkdtype(sigIn, 'RxRadarSigT')chkdtype(method, 'StringT')chkdtype(model, 'CellArrayT')%chkdtype(modelParam, 'CellArrayT')chkdtype(taperCoeff, 'CxVectorT')chkdtype(interCorrMat, 'CxMatrixT', 'EmptyT') % NFF: Check any special input parameters.% ----------------------------------------------------------------------- %% Preparations before calculations.% ----------------------------------------------------------------------- %% ****************** Get signals sizes. ******************sigSizeIn = sigsize(sigIn);noTrialsIn = sigSizeIn(6);noCpisIn = sigSizeIn(5);noExtrasIn = sigSizeIn(4);noBeamsIn = sigSizeIn(3);noRangesIn = sigSizeIn(2);noPulsesIn = sigSizeIn(1);% *************** Adjustments for different methods. ***************if (strcmp(method,'fft') | strcmp(method,'ifft')) % Special case when the number of test ranges are not determined by % "rangeChoice". dbterror('FFT or IFFT can not be used with this function.') % The reason for the this is that the Fourier tranform uses a unsuitable % basis. The basis should consist of time delayed (flipped back-forth % and complex conjugated) versions of the transmitted waveform. if isempty(extraParam) extraParam = noRangesIn; % NFF: Choose the size of the right dimension, i.e. the dimension, % in which to filter. end%if extraParam = extraParam; noChanOut = extraParam; % Number of ouput channels or samples in the dimension we are filtering. steMatIn = []; % We will not use this parameter. interCorrMat = []; % We will not use this parameter.else steMatIn = ranstemat(waveform, rangeChoice, propSpeed, interpMethod, ... storageClass, boundaryMethod); % NFF: Call the right function with right parameters. noChanOut = size(rangeChoice,2); % NFF: Choose the size of the right dimension.end%if% ****************** Calculate filtering weights. ******************sizeSigIn = [noRangesIn, noBeamsIn]; % NFF: Choose the sizes of the right dimensions.[methodCalc, weightMatrix, basisMat, freqPos] = calcfiltinit(method, ... sizeSigIn, steMatIn, taperCoeff, interCorrMat, orthBeamFlag, extraParam);%basisMat = weightMatrix;%fprintf('ranfilt: issparse(weightMatrix) = %d\n',issparse(weightMatrix));% ****************** Create output variable. ******************sigOut = sigIn; % Copy all fields to output signal.sigOut.signals = zeros(noPulsesIn, noChanOut, noBeamsIn, noExtrasIn, ... noCpisIn, noTrialsIn); % NFF: Move "noChanOut" to the right subscript. % How to split "noChanOut" into two subscripts in 2D-filtering?% ----------------------------------------------------------------------- %% Loops for several range gates and trials.% ----------------------------------------------------------------------- %spaLoopFlag = 1;% spaLoopFlag = 0 : % Do not loop over space (antenna channels). % Space is used for estimation of correlation matrix.% spaLoopFlag = 1 : % Do not loop over pulse. Loop over space. % Pulses are used for estimation of correlation matrix.if (spaLoopFlag)% ****************** Loops. ******************% Do not loop over pulse. Pulse is used for estimation of correlation matrix.for trialLoop = 1:noTrialsInfor cpiLoop = 1:noCpisIn for extraLoop = 1:noExtrasIn for spaLoop = 1:noBeamsIn % NFF: Loop over suitable dimensions => do not loop % over two suitable dimensions. %sigMatIn = sigIn.signals(:,:,spaLoop,extraLoop,cpiLoop, trialLoop); % Is this faster? Is this correct? sigMatIn = getm3(sigIn.signals, 2, [], ':',':', spaLoop, ... extraLoop, cpiLoop, trialLoop); % NFF: Get the right part of the ND-matrix. Both the % "row" input parameters and the ':' input parameters must be correct. sigMatOut = calcfiltproc(sigMatIn, methodCalc, weightMatrix, ... taperCoeff, orthBeamFlag, extraParam); sigOut.signals(':',':',spaLoop, extraLoop,cpiLoop,trialLoop) ... = sigMatOut.'; % NFF: Assign the right part of the ND-matrix. infoStr = sprintf('ranfilt: cpi = %d(%d), spa = %d(%d)\r',... cpiLoop, noCpisIn, spaLoop, noBeamsIn); % NFF: Print the right loop counter. dbtinfo(infoStr,1); end%for spaLoop end%for extraLoopend%for cpiLoopdbtinfo(''); %New line.end%for trialLoopelse (spaLoopFlag)% ****************** Loops. ******************% Do not loop over space (antenna channels). Space is used for estimation of correlation matrix.for trialLoop = 1:noTrialsInfor cpiLoop = 1:noCpisIn for extraLoop = 1:noExtrasIn for pulseLoop = 1:noPulsesIn % NFF: Loop over suitable dimensions => do not loop % over two suitable dimensions. %sigMatIn = sigIn.signals(pulseLoop,:,:,extraLoop,cpiLoop, trialLoop); % Is this faster? Is this correct? sigMatIn = getm3(sigIn.signals, 2, [], pulseLoop,':',':', ... extraLoop, cpiLoop, trialLoop); % NFF: Get the right part of the ND-matrix. Both the % "row" input parameters and the ':' input parameters must be correct. sigMatOut = calcfiltproc(sigMatIn, methodCalc, weightMatrix, ... taperCoeff, orthBeamFlag, extraParam); sigOut.signals(pulseLoop,':',':',extraLoop,cpiLoop,trialLoop) ... = sigMatOut; % NFF: Assign the right part of the ND-matrix. infoStr = sprintf('ranfilt: cpi = %d(%d), pulse = %d(%d)\r',... cpiLoop, noCpisIn, pulseLoop, noPulsesIn); % NFF: Print the right loop counter. dbtinfo(infoStr,1); end%for pulseLoop end%for extraLoopend%for cpiLoopdbtinfo(''); %New line.end%for trialLoopend%if (spaLoopFlag)% ----------------------------------------------------------------------- %% Output variables.% ----------------------------------------------------------------------- %sigOut = setrantrans(sigOut, basisMat); % NFF: Call the right function.% For Capon, only the non-adapted steering matrix is stored. See the function% "calcfiltinit".rangePosOut = rangeChoice;sigOut.ranPos = rangePosOut; % NFF: Assign the right field in the output function.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -