⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cp3_3.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%% Comprehensive Problem 3.3 %%%%%%%%%%%
%   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 CP3.3')

dpower    % read data

disp('system zeros, poles, gain for Vterminal output')
disp('*****>'), pause
G1 = tf(dnum1,dden,Ts)
[z,p,k] = zpkdata(G1);
disp('Open-loop zeros and their magnitudes')
[z{1,:} abs(z{1,:})]
disp('Open-loop poles and their magnitudes')
[p{1,:} abs(p{1,:})]
disp('Gain')
k
disp('*****>'), pause

disp('Applying PI controller to Vterminal control')
disp('PI controller is of form')
disp('             (1+K_I T_s) z - 1  ')
disp('K_V(z) = K_P(-----------------) ')
disp('                    z-1         ')
disp('K_I is set to 1')

disp('Proportional gain') 
K_P = [10 20 40 41 42 43 50]'
len_K = length(K_P);
disp('*****>'), pause

for i = 1:len_K
 disp('investigate the controller performance for K_P = ')
 K_P(i) 
 disp('controller transfer function')
 K_V = K_P(i)*tf([(1+Ts) -1],[1 -1],Ts)
 disp('*****>'), pause
 disp('Closed-loop transfer function')
 Gcl = feedback(G1*K_V,1)
 disp('*****>'), pause
 [zCL,pCL,kCL]=zpkdata(Gcl);
 disp('Closed-loop zeros')
 xy2p(zCL{1,:});
 disp('Closed-loop poles')
 xy2p(pCL{1,:});
 disp('Closed-loop system gain')
 kCL
 disp('*****>'), pause
 disp('step response')
 figure, [y,t] = step(Gcl,20);
 plot(t,0.05*y,'o'), xlabel('Time (s)'), ylabel('Amplitude')
 grid;title('CP3.3: Power system model step response with PI controller')
 text('Units','norm','Pos',[0.3 0.2],...
			'Str',['Proportional gain = ' num2str(K_P(i))])
 text('Units','norm','Pos',[0.3 0.15], 'Str', ['Integral gain = 1'])
disp('*****>'), pause
end

%
disp('end of Comprehensive Problem 3.3')
%%%%%%%%%%

⌨️ 快捷键说明

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