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

📄 cp2_3.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%% Comprehensive Problem 2.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
dpower    % read data
disp('*****>'), pause

disp(' ')
disp('system zeros, poles, gain for Vterminal output')
G1 = tf(dnum1,dden,Ts)
[z,p,k] = zpkdata(G1);
disp('Zeros are')
disp(z{:,:})
disp('Poles are')
disp(p{:,:})
disp('Gain is')
disp(k)

disp('*****>'), pause

disp('Magnitude and Phase of poles')
p_mag = abs(p{:,1}), p_ph = atan2(imag(p{:,1}),real(p{:,1}))*180/pi
disp('Magnitude and Phase of zeros')
z_mag = abs(z{:,1}), z_ph = atan2(imag(z{:,1}),real(z{:,1}))*180/pi

figure, ucircle, hold on
pzmap(G1), hold off
title('Pole-zero plot of Vterminal transfer function')
disp('Plot of pole-zero locations of Vterminal transfer function')
disp('*****>'), pause

disp('partial fraction expansion of Vterminal output')
[r,p,k] = residue(dnum1,dden)
disp('*****>'), pause

disp('system zeros, poles, gain for w(speed) output')
G2 = tf(dnum2,dden,Ts)
[z,p,k] = zpkdata(G2)
disp('*****>'), pause

disp('Magnitude and Phase of poles')
p_mag = abs(p{:,1}), p_ph = atan2(imag(p{:,1}),real(p{:,1}))*180/pi
disp('Magnitude and Phase of zeros')
z_mag = abs(z{:,1}), z_ph = atan2(imag(z{:,1}),real(z{:,1}))*180/pi

figure, ucircle, hold on
pzmap(G2), hold off
title('Pole-zero plot of w(speed) transfer function')
disp('Plot of pole-zero locations of w(speed) transfer function')
disp('*****>'), pause

disp('partial fraction expansion of w(speed) output')
[r,p,k] = residue(dnum2,dden)
disp('*****>'), pause

disp('system zeros, poles, gain for Pe output')
G3 = tf(dnum3,dden,Ts)
[z,p,k] = zpkdata(G3);
disp('*****>'), pause

disp('Magnitude and Phase of poles')
p_mag = abs(p{:,1}), p_ph = atan2(imag(p{:,1}),real(p{:,1}))*180/pi
disp('Magnitude and Phase of zeros')
z_mag = abs(z{:,1}), z_ph = atan2(imag(z{:,1}),real(z{:,1}))*180/pi

figure, ucircle, hold on
pzmap(G3), hold off
title('Pole-zero plot of Pe transfer function')
disp('Plot of pole-zero locations of Pe transfer function')
disp('*****>'), pause

disp('partial fraction expansion of Pe output')
[r,p,k] = residue(dnum3,dden)
disp('*****>'), pause

disp('Step response of Vterminal')
[y,t] = step(G1);
figure, plot(t,0.05*y,'o')
grid;title('CP2.3: Step reponse of Vterminal')
disp('The Vterminal response shows only the real decaying mode')
disp('*****>'), pause

disp('Step response of w(speed)')
[y,t] = step(G2,20);
figure, plot(t,0.05*y,'o')
grid;title('CP2.3: Step reponse of w(speed)')
disp('The w(speed) response shows both the decaying mode and ')
disp('  oscillatory mode. Also the steady-state output should')
disp('  be zero. The nonzero value is due to the less accurate')
disp('  tf polynomial form, compared to the state-space form')
disp('*****>'), pause

disp('Step response of Pe')
[y,t] = step(G3);
figure, plot(t,0.05*y,'o')
xlabel('Time (s)')
ylabel('Amplitude')
grid;title('CP2.3: Step reponse of Pe')
disp('The Pe response shows the decaying oscillatory mode')

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

⌨️ 快捷键说明

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