ex5_5.m
来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 29 行
M
29 行
%%%%%%%%%%%%%%%%%% Example 5.5 %%%%%%%%%%%%%%%%%%
% 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- frequency response of ZOH ----
%
clear
disp('Example 5.5')
fs = 10; Ts = 1/fs; % sampling frequency and period
f = [0:0.1:30]'; % frequency points from 0 to 30 Hz
Gh0 = (1-exp(-j*Ts*2*pi*f))./(j*2*pi*f); % './' is entry-wise divide
disp('The warning is due to divide by zero at zero frequency, define DC gain separately')
Gh0(1) = Ts; % define DC gain separately
figure
title('Frequency response of the Zero-Order Hold')
subplot(2,1,1)
plot(f,abs(Gh0)),grid % magnitude plot
ylabel('Magnitude')
subplot(2,1,2),
plot(f,angle(Gh0)*180/pi),grid % phase plot
ylabel('Phase (deg)')
xlabel('Frequency (Hz)')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?