📄 dtstem.m
字号:
function dtstem(line_han,x,y,mode)
% DTSTEM Generates stem plots for various ADSP GUIs.
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
if nargin<4,mode=0;end
% if nothing to plot, clear old plot and get out
if ~length(y),
return;
end
%ver_str = version;
ver4=0; %ver4 = length(findstr('4.',ver_str));
% clean up line_han. this is to remove any
% text objects that are being stored to keep track
% of the custom signal components
loc = [];
for k = 1:length(line_han),
if ~strcmp(get(line_han(k),'type'),'line'),
loc = [loc,k];
end
end
if length(loc), line_han(loc) = []; end
ly = length(y);
% make line data a row vector
y_d = y(:)';
x_d = x(:)';
if ly > 127 & mode==0,
if ver4,
set(line_han(1),'xdata',x_d,'ydata',y_d,'linestyle','-');
set(line_han(2),'xdata',x_d,'ydata',y_d,'linestyle','-');
else
set(line_han(1),'xdata',x_d,'ydata',y_d,'linestyle','-',...
'marker','none');
set(line_han(2),'xdata',x_d,'ydata',y_d,'linestyle','-',...
'marker','none');
end
else
% add the zero row vector
y_d = [y_d;zeros(1,ly)];
x_d = [x_d; x_d];
% add the NaN row vector
y_d = [y_d;zeros(1,ly)+NaN];
x_d = [x_d;zeros(1,ly)+NaN];
% reshape into a column vector
y_d = y_d(:);
x_d = x_d(:);
% update current plot
if ver4,
set(line_han(1),'xdata',x_d,'ydata',y_d,'linestyle','-');
lin_data = get(line_han(2),'userdata');
if length(lin_data),
set(line_han(2),'xdata',x,'ydata',y,'linestyle',lin_data);
else
set(line_han(2),'xdata',x,'ydata',y,'linestyle','o','marker',4);
end
else
set(line_han(1),'xdata',x_d,'ydata',y_d,'linestyle','-',...
'marker','none');
lin_data = get(line_han(2),'userdata');
if length(lin_data),
set(line_han(2),'xdata',x,'ydata',y,'marker',lin_data,...
'linestyle','none');
else
set(line_han(2),'xdata',x,'ydata',y,'marker','o',...
'markersize',4,'linestyle','none');
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -