📄 ex5_5.m
字号:
%%%%%%%%%%%%%%%%%% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -