dplot.m

来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 52 行

M
52
字号
function dplot(dataX, dataY);% It works similar to stem, but uses a triangle as the marker.% Also uses the dotted-line option for the stem part.%%%%%%%%%%%%%%%%%%%% dplot.m %%%%%%%%%%%%%%%%%%%%%   Discrete-Time Control Problems using        %%       MATLAB and the Control System Toolbox   %%   by J.H. Chow, D.K. Frederick, & N.W. Chbat  %%         Brooks/Cole Publishing Company        %%                September 2002                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if (nargin > 2) | (nargin == 0)   error('The input variables are not correct');endif nargin == 1   id     = 1:length(dataX);   pos_id = find(dataX>=0);   id(pos_id) = [];   neg_id = id;   if ~isempty(pos_id)   	stem(pos_id, dataX(pos_id), 'filled');   	ho = findobj(gca, 'marker', 'o');   	set(ho, 'marker', '^');      hold;   end   if ~isempty(neg_id)   	stem(neg_id, dataX(neg_id), 'filled');   	ho = findobj(gca, 'marker', 'o');      set(ho, 'marker', 'v');      end      line([1 length(dataX)], [0 0]);else   id     = 1:length(dataX);   pos_id = find(dataY>=0);   id(pos_id) = [];   neg_id = id;   if ~isempty(pos_id)  		 stem(dataX(pos_id), dataY(pos_id), ':','filled');	    ho = findobj(gca, 'marker', 'o');   	 set(ho, 'marker', '^');      	 hold;   end   if ~isempty(neg_id)   	stem(dataX(neg_id), dataY(neg_id),':','filled');   	ho = findobj(gca, 'marker', 'o');      set(ho, 'marker', 'v');     end	line([min(dataX) max(dataX)], [0 0]);endhold off;%%%%%%%%%%

⌨️ 快捷键说明

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