📄 plotxline.m
字号:
function plotxline(xPosition ,color, lineStyle)%PLOTXLINE Plots one or several straight lines at specified x-positions.%%--------%Synopsis:% plotxline(xPosition)% plotxline(xPosition ,color)% plotxline(xPosition ,color, lineStyle)%%Description:% Plots one or several straight lines along the y-direction at z = 0 and a% specified x-position.% In 2D plots this will be a vertical line.% This function is useful, for example, to show where a target signal% should be. The function can be used in all plot types.%%Output and Input:% xPosition (RealVectorT): The x-coordinates in the graph where to plot% the lines.% 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:%%%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:% plotyline, plotaline, plot, splot2, sigplot2% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 9xxxxx Fredrik Athley (freath).% Latest change: $Date: 2000/10/16 15:21:21 $ $Author: svabj $.% $Revision: 1.6 $% *****************************************************************************% ----------------------------------------------------------------------- %% Handle input parameters% ----------------------------------------------------------------------- %if (nargin < 1) error('DBT-Error: To few input parameters.')end% ****************** Add missing input parameters ******************arginNo=2;if (nargin < arginNo) color = [];endarginNo = arginNo +1;if (nargin < arginNo) lineStyle = [];endarginNo = arginNo +1;% ****************** Default values ******************if 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')% ----------------------------------------------------------------------- %% Plotting.% ----------------------------------------------------------------------- %ylim = get(gca,'YLim');for n=1:length(xPosition) h = line([xPosition(n) xPosition(n)],ylim); set(h,'Color',color); set(h,'LineStyle',lineStyle);end%for nset(gca,'YLim',ylim)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -