📄 periodic.m
字号:
function y = periodic(x,tp,T)
% PERIODIC Generates a periodic signal.
%
% YP = PERIODIC(FUNC,t,T) generates a periodic pulse train.
% FUNC = a string function of t describing the pulse FROM t=0.
% T = time period, t = time array over which to generate YP.
%
% If no output arguments are given, result is plotted.
%
% PERIODIC (with no input arguments) invokes the following example:
%
% % Plot a half rectified sine over [-3 3] with T=2, half-width=1
% >>t=-3:0.01:3;
% >>yp=periodic('sin(pi*t).*urect(t-0.5)',t,2);
% >>plot(t,yp)
% 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 periodic,disp('Strike a key to see results of the example')
pause,t=-3:.01:3;yp=periodic('sin(pi*t).*urect(t-0.5)',t,2);
v=matverch;
if v < 4, eval('clg');else,eval('clf');end
plot(t,yp),return,end
if tp(1)<0,t=rem(tp-T*floor(tp(1)/T),T);else,t=rem(tp,T);end
y=eval(x);
if nargout==0,plot(tp,y);end
if exist('version')~=5,pause,end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -