dplot.m

来自「里面囊括了基于matlab滤波器设计的各种.m文件」· M 代码 · 共 46 行

M
46
字号
 
 
function dplot(x,y,hue)
%DPLOT        Plot discrete sequence data.
%        DPLOT(Y) plots the data sequence Y as stems from the x-axis.
%        DPLOT(X,Y) plots the data sequence Y at the values specfied
%        in X.
%        There is an optional final string argument to specify a color
%        for the stems of the data sequence.  E.g. STEM(X,Y,'r') or
%        STEM(Y,'g').
%
%        See also PLOT, BAR, STAIRS.
%
%      

n = length(x);
if nargin == 1
        y = x(:)';
        x = 1:n;
        hue = 'k';
elseif nargin == 2
        if isstr(y)
                hue = y;
                y = x(:)';
                x = 1:n;
        else
                x = x(:)';
                y = y(:)';
                hue = 'y';
        end
elseif nargin == 3
        x = x(:)';
        y = y(:)';
end
xx = [x;x;nan*ones(size(x))];
yy = [zeros(1,n);y;nan*ones(size(y))];
cax = newplot;
next = lower(get(cax,'NextPlot'));
hold_state = strcmp(next,'add') & 
strcmp('add',lower(get(gcf,'NextPlot')));
h = plot(xx(:),yy(:),hue);
v = axis;
v(2) = n+1;
axis(v);
%xlabel('Impulse Response');
xlabel('Time domain');

⌨️ 快捷键说明

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