dhydro.m

来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 56 行

M
56
字号
%%%%%%%%% Comprehensive Problem dhydro.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                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hydro-turbine System
% This M-file contains the model of the hydro-turbine 
% system described in Appendix A. 
% The turbine has 1 state, 1 input, and 1 output. 
% The actuator has 1 state, 1 input, and 1 output.


%  model parameters
Tw = 2;         % s, water time constant
TQ = 0.5;       % s, actuator time constant

%  transfer function
hydro_num = [-Tw 1];
hydro_den = [Tw/2 1];
hydro     = tf(hydro_num,hydro_den);

% actuator transfer function
act_num = 1;
act_den = [TQ 1];
act     = tf(act_num,act_den);

% continuous-time model
Gs = ss(hydro)*ss(act);
[num,den] = tfdata(Gs,'v');
[A,B,C,D] = ssdata(Gs);

% discretization
Ts = 0.1;   % sampling at 10 Hz
Gz = c2d(Gs,Ts,'zoh');
[dnum,dden] = tfdata(Gz,'v');
[Ad,Bd,Cd,Dd] = ssdata(Gz);

disp('Hydro-turbine system continuous-time model')
disp('  transfer function is in num,den')
disp('  state-space model is in A B C D')
disp('  LTI object is in Gs')
disp(' ')
disp('Hydro-turbine system discretized model obtained using')
disp('  a sampling time of 0.1 sec and a zero-order hold')
disp('Hydro-turbine system discrete-time model')
disp('  transfer function is in dnum,dden')
disp('  state-space model is in Ad Bd Cd Dd')
disp('  LTI object is in Gz')

disp('The system data are saved in hydro.mat')

save hydro.mat A B C D Gs num den ...
               Ad Bd Cd Dd Gz dnum dden
%%%%%%%%%%

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?