📄 digiplot.m
字号:
function [td0,yd0] = digiplot(t,y,lin,clr)
% DIGIPLOT Plot of staircase type function.
%
% [TD,YD] = DIGIPLOT(T,Y) returns plotting data TD and YD of
% Y versus T as a staircase function. No plot is drawn.
% DIGIPLOT(T,Y,LIN,CLR) plots with line type and color [Default: '-']
%
% DIGIPLOT (with no input arguments) invokes the following example:
%
% >>digiplot([1 2 3 5 7],[6 4 2 7 5])
% 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 == 0,
help digiplot
disp('Strike a key to see results of the example')
pause
subplot
ax=[0 10 0 10];
axis(ax)
digiplot([1 2 3 5 7],[6 4 2 7 5]),
axis(ax)
grid
hold off
return
end
v=3;if exist('version')==5,vr=version;v=eval(vr(1));end
if nargin < 4, clr='r';end
if nargin < 3, lin = '-'; end
if v<5,ty=[lin,clr];else,ty=[clr,lin];end
t = t(:).';
y = y(:).';
n = length(y);
y = [y(1) y];
t = [t t(n)];
yd = [y;y];
yd = yd(:);
td = [t;t];
td = td(:);
td = [td(1);td(1:2*n+1)];
if nargout == 0,
plot(td,yd,ty)
else
td0 = td;
yd0 = yd;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -