1.设计流程
2. 模型
3. select_poles
function p = select_poles(order, t_settle, damp_ratio, settling_pct)
%SELECT_POLES Determine pole locations for pole placement design.
%
% P = SELECT_POLES(ORDER, T_SETTLE, DAMP_RATIO) computes a set
% of pole locations for the system order ORDER, with settling
% time T_SETTLE (in seconds) and a damping ratio of DAMP_RATIO
% where (0 < DAMP_RATIO < 1). The settling percentage error
% defaults to 1%.
%
% P = SELECT_POLES(ORDER, T_SETTLE, DAMP_RATIO, SETTLING_PCT)
% allows the settling percentage error SETTLING_PCT to be
% specified.
%
% The poles are located equidistantly along an arc in the
% complex plane that satisfies the given settling time and
% damping ratio constraints.
%
% Example: p = select_poles(4, 0.5, 0.8, 0.02)
% This computes the poles for a 4th order system with a settling
% time of 0.5 seconds, a damping ratio of 0.8 and a settling
% error of 2%. The result is p = (-7.8240 +/- 5.8680i,
% -9.5559 +/- 2.0818i).
%
% By Jim Ledin 2002.
if nargin < 4
settling_pct = 0.01; % If no settling percentage given, use 1%
end
settling_limit = -log(settling_pct) / t_settle;
amplitude = settling_limit / damp_ratio;
order_is_odd = (mod(order, 2) == 1);
if order_is_odd
n_complex_pairs = (order-1) / 2;
p(n_complex_pairs+1) = -amplitude; % One pole is on the real axis
else
n_complex_pairs = order / 2;
end
if order > 1
angle = acos(damp_ratio);
d_theta = 2*angle / (order-1);
theta = pi - angle + (0:(n_complex_pairs-1))*d_theta;
p(1:n_complex_pairs) = amplitude * exp(i*theta);
if order_is_odd
p(n_complex_pairs+2:2*n_complex_pairs+1) = conj(p(n_complex_pairs:-1:1));
else
p(n_complex_pairs+1:2*n_complex_pairs) = conj(p(n_complex_pairs:-1:1));
end
end
4.plot_poles
function plot_poles(sscl, t_settle, damp_ratio)
%PLOT_POLES Plot system pole locations with settling time and damping ratio constraints.
%
% PLOT_POLES(SSCL, T_SETTLE, DAMP_RATIO)
%
% This function plots the pole locations for the closed loop
% system SSCL along with the settling time constraint
% T_SETTLE (in seconds) and damping ratio DAMP_RATIO.
% By Jim Ledin, 2002.
plot(pole(sscl), 'o')
axis equal
a = axis;
x_min = a(1); x_max = a(2);
y_min = a(3); y_max = a(4);
settling_pct = 0.01; % If no settling percentage given, use 1%
settling_limit = -log(settling_pct) / t_settle;
if x_max < -settling_limit + 0.1*(x_max - x_min)
x_max = -settling_limit + 0.1*(x_max - x_min);
a(2) = x_max;
end
hold on
plot([x_min x_max], [0 0], '--k')
plot([0 0], [y_min y_max], '--k')
plot([-settling_limit -settling_limit], [y_min y_max]);
angle = acos(damp_ratio);
plot([x_min 0 x_min], [x_min*tan(angle) 0 -x_min*tan(angle)])
axis(a)
hold off