📄 operate.m
字号:
function [ta,y] = operate(t,x,s,d)
% OPERATE Time scaling and time shifting operations for CT signals.
%
% [TN,YN] = OPERATE(t,x,A,B) generates time and signal values for
% x(A*t+B) from given values of t and x(t).
% DEFAULT VALUES: B=0 if not specified. A=1 if not bspecified.
%
% [TN,YN] = OPERATE(t,x,A) generates time and signal values for
% x(A*t) from given values of t and x(t). [Default value: A=1]
%
% OPERATE (with no input arguments) invokes the following example:
%
% % First generate x(t)=u(t+1)-r(t)+r(t-1)
% % Then sketch x(t) and x(0.5t-2)
% >>t=-4:.02:4;
% >>x=ustep(t+1)-uramp(t)+uramp(t-1);
% >>[t1,x1]=operate(t,x,0.5,-2);
% >>plot(t,x,t1,x1)
% 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 operate
disp('Strike a key to see results of the example')
pause
t=-4:.02:4;
x=ustep(t+1)-uramp(t)+uramp(t-1);
[t1,x1]=operate(t,x,.5,-2);
v=matverch;
if v < 4, eval('clg');else,eval('clf');end
axis([-4 12 0 2])
plot(t,x,t1,x1)
axis([-4 12 0 2])
grid
hold off
return
end
if nargin > 1 & nargin < 5,
if nargin<4,
d=0;
end
if nargin<3,
s=1;
end
ta=(t-d)/s;
if nargout>1,
y=x;
if s<0,
ta=fliplr(ta);
y=fliplr(y);
end
end
elseif nargin == 1,
error('Not enough input arguments');
elseif nargin > 4,
error('Too many input arguments');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -