⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plotaline.m

📁 阵列信号处理的工具箱
💻 M
字号:
function plotaline(xPos, yPos, zPos, color, lineStyle)%PLOTALINE Plots one or several straight line at specified xyz-positions.%%--------%Synopsis:%  plotaline(xPos)%  plotaline(xPos,[],[],color)%  plotaline(xPos,[],[],color, lineStyle)%  plotaline(xPos, yPos, zPos)%  plotaline(xPos, yPos, zPos, color, lineStyle)%%Description:%  Plots one or several straight lines at specified position.%  This function is useful, for example, to show where a target signal%  should be.%%Output and Input:%  xPos (RealScalarT or StringT): The x-coordinate in the graph where to plot%    the line.%    = 'a': Plot from current min to curent max along this direction.%      Only one of "xPos", "yPos", "zPos" can have the value 'a'.%    = 's': Plot at min of this direction (x).%    = 'e': Plot at min of this direction (x).%    = RealScalarT: Plot at this coordinate for this direction (x).%    = RealVectorT: Plot at these coordinates for this direction (x).%  yPos (RealScalarT or StringT): The y-coordinate in the graph where to plot%    the line. See "xPos".%  zPos (RealScalarT or StringT): The z-coordinate in the graph where to plot%    the line.  See "xPos".%  color [D](?): A three-element RGB vector or one of MATLAB's predefined%    names, specifying the Line color.%  lineStyle [D](StringT): Line style. This property specifies the line style.%    The available line styles are:%    Symbol    Line Style%    -         solid line (default)%    --        dashed line%    :         dotted line%    -.        dash-dot line%    none      no line%%--------%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:%  plotaline('a',[75 100],0)%  plotaline('a',[75 100],[0 0])%  plotaline('a',[75 100],[-15 -15])%  plotaline([-13 0])%  plotaline([-13 0],'a',0)%  plotaline('a',[75 100 122 135],'s')%  plotaline('a',[75 100 122 135],'e')%%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:%  plotxline, plotyline, plot, splot2, sigplot2%   *  DBT, A Matlab Toolbox for Radar Signal Processing  *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%%  Start        : 980710 Svante Bj鰎klund (svabj).%  Latest change: $Date: 2000/10/16 15:21:20 $ $Author: svabj $.%  $Revision: 1.4 $% *****************************************************************************% ----------------------------------------------------------------------- %% Handle input parameters% ----------------------------------------------------------------------- %if (nargin < 1)  error('DBT-Error: To few input parameters.')end% ****************** Add missing input parameters ******************arginNo=2;if (nargin < arginNo)  yPos = [];endarginNo = arginNo +1;if (nargin < arginNo)  zPos = [];endarginNo = arginNo +1;if (nargin < arginNo)  color = [];endarginNo = arginNo +1;if (nargin < arginNo)  lineStyle = [];endarginNo = arginNo +1;% ****************** Default values ******************if isempty(yPos)  yPos = 'a';end%ifif isempty(zPos)  zPos = 's';end%ifif isempty(color)  color = get(gca,'ColorOrder');  color = color(1,:);end%ifif isempty(lineStyle)  lineStyle = get(gca,'LineStyleOrder');  lineStyle = lineStyle(1,:);end%if% ****************** Error check input parameters ******************%chkdtype(scaleType, 'StringT')%chkdtype(plotType, 'StringT')% ****************** Convert to column vectors ******************xPos = xPos(:);yPos = yPos(:);zPos = zPos(:);% ----------------------------------------------------------------------- %% Preparation for plot.% ----------------------------------------------------------------------- %nLines = max([max(size(xPos)), max(size(yPos)),max(size(yPos))]);xPosUse = prepPos(xPos,'X',nLines);yPosUse = prepPos(yPos,'Y',nLines);zPosUse = prepPos(zPos,'Z',nLines);% ----------------------------------------------------------------------- %% Plotting.% ----------------------------------------------------------------------- %for n=1:nLines  h = line(xPosUse(n,:), yPosUse(n,:), zPosUse(n,:));  set(h,'Color',color);  set(h,'LineStyle',lineStyle);end%for n%endfunction plotaline% ----------------------------------------------------------------------- %% Prepare positions.% ----------------------------------------------------------------------- %function xyzPosUse = prepPos(xyzPos,limLetter,nLines)  False = 0;  True = 1;  xyzAxis = False;  xyzLim = get(gca,[limLetter 'Lim']);  xyzPosLen = size(xyzPos,1);  if strcmp(xyzPos,'a')    xyzPosUse = repmat(xyzLim,nLines,1);   elseif (strcmp(xyzPos,'s'))    xyzPosUse = repmat(xyzLim(1),nLines,2);  elseif (strcmp(xyzPos,'e'))    xyzPosUse = repmat(xyzLim(2),nLines,2);  elseif ((xyzPosLen == 1))    xyzPosUse = repmat(xyzPos,nLines,2);  elseif ((xyzPosLen > 1) & (xyzPosLen ~= nLines))    errStr = sprintf('DBT-Error: Invalid number of %s positions.',limLetter);    error(errStr)  else    xyzPosUse = repmat(xyzPos, 1,2);  end%if%endfunction

⌨️ 快捷键说明

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