📄 sigsplitdim.m
字号:
function sigOut = sigsplitdim(sigIn, splitDim, splitLen, newDim)%SIGSPLITDIM Splits a dimension in a radar signal into two dimensions.%%--------%Synopsis:% sigOut = sigsplitdim(sigIn, splitDim, splitLen, newDim)%%Description:% Splits a dimension in a radar signal into two dimensions.% This is useful, for example, when dividing the pulses (dimension 1) of a% radar signal into groups (e.g. CPIs, dimension 5) where each group can% be used as a snapshot for the target and interference estimation (via the % space-time correlation matrix).%%Output and Input:% sigOut (RxRadarSigT) : Radar signal after dimension split.% sigIn (RxRadarSigT) : Radar signal before dimension split.% splitDim (IntScalarT): The index of the dimension to split into two.% splitLen (IntScalarT): The length of the "splitDim" after the split.% newDim (IntScalarT): The index of the new dimension. The size of this % dimension before the split must be one.%%--------%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:% s = RxRadarSigT;% s.signals = ones([4 6 8 1 1]);% s2 = sigsplitdim(s,1,2,4);% size(s2.signals)%% ans = % 2 6 8 2 %%Software Quality:% (About what is done to ascertain software quality. What tests are done.)% This function has been tested by test 103 in the test script "tdbt.m".%%Known Bugs:% Maybe the updating of the fields "waveform", "pulIx", "ranIx" etc. in% the output radar signal is incorrect.%%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:% sigsize msigmat2 sigsubix% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 991016 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:21:48 $ $Author: svabj $.% $Revision: 1.5 $% *****************************************************************************% ----------------------------------------------------------------------- %% Handle input parameters% ----------------------------------------------------------------------- %arginNo=4;if (nargin < arginNo) error('DBT-Error: To few input parameters.')endarginNo = arginNo +1;% ****************** Add missing input parameters ******************%if (nargin < arginNo)% method = [];%end% ****************** Default values ******************%if isempty(method)% method = [];%end%if% ****************** Error check input parameters ******************chkdtype(sigIn, 'RxRadarSigT')chkdtype(splitDim, 'IntScalarT')chkdtype(splitLen, 'IntScalarT')chkdtype(newDim, 'IntScalarT')sizeSpec = sizem(sigIn.signals);if (rem(sizeSpec(splitDim), splitLen) ~= 0) error('DBT-Error: Size of splitDim must be multible of splitLen.')end%ifif (sizeSpec(newDim) ~= 1) dbterror('The size of the new dimension must be one.')end%if% ****************** Create output variable ******************sigOut = sigIn;% ----------------------------------------------------------------------- %% RxRadarSigT: Radar signals.% ----------------------------------------------------------------------- % % ****************** Signal size ****************** noPulses = sizeSpec(1); noRanges = sizeSpec(2); noChannels = sizeSpec(3); noExtras = sizeSpec(4); noCPIs = sizeSpec(5); noTrials = sizeSpec(6); maxDim = 6; % ****************** Permute Order 1 ****************** permuteOrder1 = 1:maxDim; permuteOrder1 = swap(permuteOrder1, splitDim, newDim-1); sigMat = permute(sigIn.signals, permuteOrder1); % ****************** Reshape sizes ****************** ss = sizem(sigMat); newDimLen = fix(ss(newDim-1) / splitLen); reshapeSizes = ([ss(1:newDim-2), splitLen, newDimLen, ss((newDim+1):maxDim)]); sigMat = reshape(sigMat, reshapeSizes); % ****************** Permute Order 2 ****************** sigOut.signals = permute(sigMat, permuteOrder1); % ****************** Update size information ****************** ss = sizem(sigOut.signals); sigOut.waveform.noPulses = ss(1); sigOut.waveform.noCPI = ss(5); if ((splitDim == 2) | (newDim == 2)) dbtwarning('The contents of "sigOut.waveform" will be incorrect.') % Because "waveform.noRangeBins" is not updated. Should it be updated? end%if if isfield(sigIn,'spaIx') sigOut.pulIx = sigIn.pulIx(1:ss(1)); sigOut.ranIx = sigIn.ranIx(1:ss(2)); sigOut.spaIx = sigIn.spaIx(1:ss(3)); end%if%endfunction sigsplitdimfunction vectorOut = swap(vectorIn, index1, index2) tmp = vectorIn(index1); vectorIn(index1) = vectorIn(index2); vectorIn(index2) = tmp; vectorOut = vectorIn;%endfunction swap
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -