sigplot2.m

来自「阵列信号处理的工具箱」· M 代码 · 共 877 行 · 第 1/2 页

M
877
字号
function [Xout, xValues, yValues, xstr, ystr, handles, contMat] = sigplot2(signal, pulseIx, rangeIx, thetaIx, extraIx, cpiIx, sigType, sigPart, scaleType, normType, plotType, lineSpec, pulAxis, ranAxis, spaAxis, extraAxis, cpiAxis, normMinLevel, normMaxLevel, plotMinLevel, plotMaxLevel, sigMinVal, sigMaxVal, extraPlotParam, guiFlag)%SIGPLOT2 Plots a 1D- or 2D-slice of a radar signal.%%--------%Synopsis:%  sigplot2(signal, pulseIx, rangeIx, thetaIx)%  sigplot2(signal, pulseIx, rangeIx, thetaIx, [], [], sigType, sigPart,%    scaleType)%  sigplot2(signal, pulseIx, rangeIx, thetaIx, [], cpiIx, sigType, sigPart,%    scaleType, normType, plotType, lineSpec)%  sigplot2(signal, pulseIx, rangeIx, thetaIx, [], cpiIx, sigType,%    sigPart, scaleType, normType, plotType, lineSpec, pulAxis, ranAxis,%    spaAxis)%  sigplot2(signal, pulseIx, rangeIx, thetaIx, [], cpiIx, sigType,%    sigPart, scaleType, normType, plotType, lineSpec, pulAxis, ranAxis,%    spaAxis, [],[], normMinLevel, normMaxLevel, plotMinLevel, plotMaxLevel,%    sigMinVal, sigMaxVal, extraPlotParam)%%  sigplot2(signal, pulseIx, rangeIx, thetaIx, keywordList)%%  Xout = sigplot2(signal,...)%  [Xout, xValues, yValues] = sigplot2(signal, ...)%  [Xout, xValues, yValues, xstr, ystr] = sigplot2(signal, ...)%  [Xout, xValues, yValues, xstr, ystr, handles, contMat] %     = sigplot2(signal, ...)%%Description:%  Plots a 2D-slice of a radar signal.%  The notation ':' can be used to denote all indices in one dimension, e.g.%  sigplot2(sig,':',':',1,1,1)%  The order of operations is:%  1) Get the part of the signal with the right indices.%  2) Create the signal type indicated by the input parameter "sigType".%  3) Get the part of the signal indicated by the input parameter "sigPart".%  4) Normalize the signal in the way indicated by "normType".%  5) Convert the signal to the scale type indicated by "scaleType".%  6) Remove values (set to NaN) below "plotMinLevel" and above "plotMaxLevel".%  7) "sigMinVal" specifies the signal value to use at the minimum level%    (given by plotMinLevel) to plot. Default value is NaN.%  8) Plot the signal with the plot type indicated by "plotType".%%Output and Input:%  Xout (CxMatrixT): The processed signal matrix after step 1)-5) of the%   "description". This is what is plotted by this function. This matrix%    is returned for the case the user want to plot it himself/herself.%  xValues (): Values of x-axis.%  yValues (): Values of y-axis.%  xstr (StringT): Label of x-axis.%  ystr (StringT): Label of y-axis.%  handles (?): One or more handle(s) of the just created graphics object(s).%    Not applicable for plotType 'stairs'.%  contMat (?): Contour matrix returned by the Matlab functions "countour"%    etc. "contMat" is called only "C" in the help text of "contour".%    "contMat" can be used as input to the Matlab function "clabel" to add %    height labels to a two-dimensional contour plot.%%  signal (RxRadarSigT): Input radar signal.%  pulseIx (IndexT): Index for pulses or doppler channels.%  rangeIx [D](IndexT): Index for range bins.%  thetaIx [D](IndexT): Index for theta channels or beams.%%  keywordList [D](CellArrayT): A cell array with input parameter name%    (keyword) and value pairs, see the example below. All input parameters%    of this function following "thetaIx" can be used. The use of keywords%    is to make calls simpler to this function with many possible input%    parameters.%%  extraIx [D](IndexT): Extra index.%  cpiIx [D](IndexT): Index for CPIs.%  sigType [D](StringT): Signal type.%    = 'sig': The signal itself (default).%    = 'fft': FFT of the signal.%  sigPart [D](StringT): What part of the signal to plot.%    = 'abs': Absolute value (default).%    = 'angle': Phase angle with Matlab:s "angle()" function.%    = 'uwangle': Phase angle with Matlab:s "unwrap(angle())" function.%       This gives a continous phase angle.%    = 'real': Real part.%    = 'imag': Imaginary part.%  scaleType [D](StringT): Scale Type for vertical axis.%    = 'lin': Linear scale.%    = 'dB': dB scale (20*log10(X)). This is a power measure.%    = 'log': 10*log10(X).%    = 'radians': Does nothing. Suitable to display phase angles in radians.%      The same effect can be done with 'lin'.%    = 'degrees': Divide by 180 and multiplicate by pi. Suitable to display%      phase angles in degrees instead of radians.%    = 'pirad': Divide by pi. Suitable to display phase angles in multiples%      of pi radians%  normType [D](StringT): Type of normalization.%    = 'min': Normalize the minimum of the signal to "normMinLevel",see below.%    = 'max': Normalize the maximum of the signal to "normMaxLevel",see below.%    = 'none' : No normalization is done.%  plotType [D](StringT): Plot type.%    3D-plots:%    = 'surfl': Iluminated surface plot (Default).%    = 'surf': See online MATLAB Function Reference.%    = 'surfc': See online MATLAB Function Reference.%    = 'mesh': See online MATLAB Function Reference.%    = 'meshc': See online MATLAB Function Reference.%    = 'meshz': See online MATLAB Function Reference.%    = 'pcolor': See online MATLAB Function Reference.%    = 'contour': See online MATLAB Function Reference. "extraPlotParam" can%      be used as the input parameters "n" or "v" to "contour".%    = 'contourf': See online MATLAB Function Reference. "extraPlotParam" can%      be used as the input parameters "n" or "v" to "contourf".%    = 'contour3': See online MATLAB Function Reference. "extraPlotParam" can%      be used as the input parameters "n" or "v" to "contour3".%    = 'plot': Like plotting a matrix with MATLABs "plot". Several lines are %      plotted on each other in 2D.%    For 2D-plots:%    = 'bar': Vertical bar plot.%    = 'barh': Horizontal bar plot.%    = 'bar3': 3D bar plot.%    = 'plot': Using MATLAB's "plot" function.%    = 'stem': Using MATLAB's "stem" function.%    = 'stairs': Using MATLAB's "stairs" function.%    All plots:%    = 'noplot' : No plot but returning the processed signal to an%      output parameter "Xout".%  lineSpec [D](StringT) : Specifies a line style, marker symbol, and color%    for the plot when the undelying Matlab plot function allows that. (see%   LineSpec in Matlab HelpDesk for more information).%  pulAxis [D](RealVectorT): Values on the pulse or doppler channel axis.%  ranAxis [D](RealVectorT): Values on range axis.%  spaAxis [D](RealVectorT): Values on antenna channel, beam or DOA axis.%  normMinLevel [D](RealScalarT): Minimum value in a linear amplitude scale.%    Note: This can be a very small value but not zero.%  normMaxLevel [D](RealScalarT): Maximum value in a linear amplitude scale.%  plotMinLevel [D](RealScalarT): Minimum signal level to plot.%  plotMaxLevel [D](RealScalarT): Maximum signal level to plot.%  sigMinVal [D] (RealScalarT): Signal value to use at the minimum level%    (given by plotMinLevel) to plot. Default value is NaN.%  extraPlotParam [D](?): Extra input parameters to MATLAB's plotting%    function (as determined by "plotType"").%%--------%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 ...%  [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%  method.%%Examples:%  Example 1:%    ant = defant('expAnt');%    expFileName = 'filename'%    sig = expsig1(ant,[expFileName, '.dbs']);%    figure, sigplot2(sig,5,1:20,6,[],[],[],'angle');%    figure%    [Xout,xValues,yValues,xstr,ystr]=sigplot2(sig,':',10,':',[],[],[],'angle');%    surfl(xValues, yValues, Xout);%    colormap copper;%    view([-37 50])%    xlabel([xstr ]);%    ylabel([ystr ])%%  Example 2:%    ant = defant('expAnt');%    expFileName = 'filename'%    sig = expsig1(ant,[expFileName, '.dbs']);%    sigplot2(sig,5,1:20,6,{'sigPart','angle',  'scaleType','pirad'});%%Software Quality:%  (About what is done to ascertain software quality. What tests are done.)%%Known Bugs:%  It is unclear if the levels are correct when using scaleType = 'dB'. (in%  conjuction with "dbf" and tapering)%%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:%  splot2, doaspc2sig, correig2sig%   *  DBT, A Matlab Toolbox for Radar Signal Processing  *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.% Start        : 970725 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:21:42 $ $Author: svabj $.% $Revision: 1.55 $% *****************************************************************************%Function Calls:%  sigplot2win -> sigplot2winGUIcb -> sigplot2%  sigplot2win_s -> sigplot2win -> sigplot2winGUIcb -> sigplot2%  "A -> B" means that A calls B.if (nargin < 2)  error('DBT-Error: To few input parameters.')end% ****************** Add missing input parameters ******************if (nargin < 3)  rangeIx = [];endif (nargin < 4)  thetaIx = [];endif (nargin < 5)  extraIx = [];endif (nargin < 6)  cpiIx = [];endif (nargin < 7)  sigType = [];endif (nargin < 8)  sigPart = [];endif (nargin < 9)  scaleType = [];endif (nargin < 10)  normType = [];endif (nargin < 11)  plotType = [];endif (nargin < 12)  lineSpec = [];endif (nargin < 13)  pulAxis = [];endif (nargin < 14)  ranAxis = [];endif (nargin < 15)  spaAxis = [];endif (nargin < 16)  extraAxis = [];endif (nargin < 17)  cpiAxis = [];endif (nargin < 18)  normMinLevel = [];endif (nargin < 19)  normMaxLevel = [];endif (nargin < 20)  plotMinLevel = [];endif (nargin < 21)  plotMaxLevel = [];endif (nargin < 22)  sigMinVal = [];end% A jump to 24 because the input parameter "sigMaxVal" is not used.if (nargin < 24)  extraPlotParam = [];endif (nargin < 25)  guiFlag = [];end% *************** Evalute the list "extraIx" 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 (iscell(extraIx))  % Now extraIx == keywordList is interpreted as a cell array with input  % parameter name (keyword) and value pairs.  keywordList = extraIx;  extraIx = [];  lenExtra = length(keywordList);  if (mod(lenExtra,2) ~= 0), error('DBT-Error: Value missing.'),end%if  for n = 1:2:lenExtra    eval([keywordList{n} '= keywordList{n+1};' ]);  end%for nendif ((exist('sigMaxVal') == 1) & (~isempty(sigMaxVal))) %Is a variable in the workspace.  dbtwarning('The input parameter sigMaxVal has changed name to plotMaxLevel.')  %error('DBT-Error: The input parameter sigMaxVal has changed name to plotMaxLevel.')end%ifif ((exist('sigMinLevel') == 1)) %Is a varibale in the workspace.  error('DBT-Error: The input parameter sigMinLevel has changed name to sigMinVal.')end%if% ****************** Default values ******************if isempty(rangeIx)  rangeIx = 1;end%ifif isempty(thetaIx)  thetaIx = 1;end%ifif isempty(extraIx)  extraIx = 1;end%ifif isempty(cpiIx)  cpiIx = 1;end%ifif isempty(sigType)  sigType = 'sig';end%ifif isempty(sigPart)  sigPart = 'abs';end%ifif isempty(scaleType)  scaleType = 'lin';end%ifif isempty(normType)  normType = 'none';end%ifif isempty(plotType)  plotType = 'surfl';end%ifif isempty(lineSpec)  lineSpec = '';end%ifif isempty(pulAxis)  pulAxis = [];end%ifif isempty(ranAxis)  ranAxis = [];end%ifif isempty(spaAxis)  spaAxis = [];end%ifif isempty(extraAxis)  extraAxis = [];end%ifif isempty(cpiAxis)  cpiAxis = [];end%ifif isempty(normMinLevel)  normMinLevel = 1e-4;end%ifif isempty(normMaxLevel)  normMaxLevel = 1;end%ifif isempty(sigMinVal)  sigMinVal = NaN;end%if% The input parameter "sigMaxVal" is not used.if isempty(extraPlotParam)  extraPlotParam = [];end%ifif isempty(guiFlag)  guiFlag = 0;end%if% Default values for plotMinLevel and plotMaxLevel is determined during plot% by Matlab.% ****************** Find which indices that are vectors ******************if (length(pulseIx) > 1)  pulseIxHlp = ':';else  pulseIxHlp = pulseIx;end%ifif (length(rangeIx) > 1)  rangeIxHlp = ':';else  rangeIxHlp = rangeIx;end%ifif (length(thetaIx) > 1)  thetaIxHlp = ':';else  thetaIxHlp = thetaIx;end%ifif (length(extraIx) > 1)  extraIxHlp = ':';else  extraIxHlp = extraIx;end%ifif (length(cpiIx) > 1)  cpiIxHlp = ':';else  cpiIxHlp = cpiIx;end%ifindex = [pulseIxHlp; rangeIxHlp; thetaIxHlp; extraIxHlp; cpiIxHlp];stop  = 0;yindex = 999;n = 1;while ((n <= 5) & (~stop))  if ((index(n,1) == ':') | (size(index(n,:),2) > 1))    % The first vector is found.    yindex = n;    stop = 1;  end;  n = n +1;end%whileif (yindex == 999)  dbterror('At least one index must be a vector.')end%stop  = 0;xindex = 999;  % This value will remain if a second vector is not found.  % If a second vector is not found, xindex is not used.  % The statement above is necessary to avoid an error message.while ((n <= 5) & (~stop))  if ((index(n,1) == ':') | (size(index(n,:),2) > 1))    % The second vector is found.    xindex = n;    stop = 1;  end;  n = n +1;end%whilewhile (n <= 5)  if ((index(n,1) == ':') | (size(index(n,:),2) > 1))    dbterror('Maximum two indices can be vectors.')  end;  n = n +1;end%while

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?