📄 foh.m
字号:
function foh(y,alpha,Ts)% plot the output of fractional-order hold% % input: y - discrete signal vector as input signal to a fractional % order hold% alpha - 0 <= alpha <= 1, hold characteristics% Ts = sampling period%%%%%%%%%%%%%%%%%%%%% foh.m %%%%%%%%%%%%%%%%%%%%%% Discrete-Time Control Problems using %% MATLAB and the Control System Toolbox %% by J.H. Chow, D.K. Frederick, & N.W. Chbat %% Brooks/Cole Publishing Company %% September 2002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%n = length(y);% first point - need special logic% it is always assumed that the -1 point is zero%figureplot([-1 0]*Ts,[0 0])hold on plot([0 0]*Ts,[0 y(1)])plot(0,y(1),'o')yfoh(2) = y(1)+y(1)*alpha;plot([0 1]*Ts,[y(1) yfoh(2)])disp('<< press space bar to continue >>'), pausefor ii = 2:n plot([ii-1 ii-1]*Ts,[yfoh(ii) y(ii)]) plot((ii-1)*Ts,y(ii),'o') yfoh(ii+1) = y(ii)+(y(ii)-y(ii-1))*alpha; plot([ii-1 ii]*Ts,[y(ii) yfoh(ii+1)]) disp('<< press space bar to continue >>'), pauseendtitle('Output of Fractional Order Hold')xlabel('Time (k*Ts)')ylabel('Amplitude')hold off %%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -