📄 cp5_5.m
字号:
%%%%%%%%%%% Comprehensive Problem 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Electric Power Generation System
clear all, close all
disp('Comprehensive Problem CP5.5')
dpower % read data
disp('Power system model state matrices, with Vterminal, ')
disp(' w(speed), and P(power) as output')
disp('Continuous-time model')
disp('*****>'), pause
Gs
disp('discretized model with a sampling period of 0.01 s')
Ts = 0.01
Gz001 = c2d(Gs,Ts)
disp('Note that most of the zero entries of the A & B matrices')
disp(' of the continuous time model have become nonzero in the')
disp(' discrete time models. The C & D matrcies are unchanged.')
disp('*****>'), pause
% comparing poles of continuous and discrete-time systems
disp('Poles of continuous-time system')
pGs = pole(Gs)
disp('*****>'), pause
disp('Poles of system discretized at 0.01 s')
xy2p(pole(Gz001));
disp('*****>'), pause
disp('Poles of system discretized at 0.01 s using the formula')
disp(' z = exp(s*T_s)')
pGzf = exp(pGs*Ts)
% comparing zeros
disp('Zeros for Vterminal output')
disp('Continuous-time model')
zGs1 = tzero(Gs(1,1))
disp('Discrete-time model zeros')
xy2p(tzero(Gz001(1,1)));
disp('*****>'), pause
disp('Zeros for w(speed) output')
disp('Continuous-time model')
zGs1 = tzero(Gs(2,1))
disp('Discrete-time model zeros')
xy2p(tzero(Gz001(2,1)));
disp('*****>'), pause
disp('Zeros for P(power) output')
disp('Continuous-time model')
zGs1 = tzero(Gs(3,1))
disp('Discrete-time model zeros')
xy2p(tzero(Gz001(3,1)));
disp('*****>'), pause
% discretization at a lower rate
Gz05 = c2d(Gs,0.5)
xy2p(pole(Gz05));
[y05,t05] = step(Gz05(3,1));
figure
stem(t05,0.05*y05), xlabel('Time (s)'), ylabel('Amplitude'), grid
title('Step response of output power for system discretized at 0.5 s')
disp('*****>'), pause
[y01,t01] = step(Gz001(3,1));
figure
plot(t01,0.05*y01,'o'), xlabel('Time (s)'), ylabel('Amplitude'), grid
title('Step response of output power for system discretized at 0.01 s')
disp('The oscillation of the system discretized at 0.5 s is slower,')
disp('i.e., has a longer period, than that discretized at 0.01 s')
disp('*****>'), pause
disp('end of Comprehensive Problem 5.5')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -