Error occurs when creating Pole-Zero Map using pzmap()
古いコメントを表示
% Define system parameters
m = 0.5; % kg
l = 1.5; % meters
b = 2; % Nms/rad
g = 9.8; % m/s^2
% Define symbolic variables
syms s tau theta
% Linearized equation of motion
eqn = m * l^2 * s^2 * theta + b * s * theta - m * g * l * theta == tau;
% Solve for transfer function H(s) = Theta(s) / Tau(s)
H = solve(eqn, theta/tau);
% Convert the symbolic transfer function to a function handle
H_function = matlabFunction(H);
% Plot poles of the transfer function
figure;
pzmap(H_function(s, 0), '-'); % '-' for inverted, '+' for upright
title('Pole-Zero Map');
legend('Inverted Configuration', 'Upright Configuration');
採用された回答
その他の回答 (1 件)
I wanted to bring to your attention that, based on the documentation, it appears that the pidTuner() function is unable to accept "desired pole locations" as input and returns "PID gains" as output. In order to achieve the placement of the closed-loop poles at the desired locations, it is necessary to utilize the place() command.
It's worth noting that the place(A, B, p) syntax requires the plant to be defined in state-space representation. Therefore, if one intends to apply the pole placement method to a given plant transfer function, it must first be converted into state-space form. This conversion will allow for the extraction of both the state matrix
and the input matrix
.
To illustrate this process, I have provided an example below that demonstrates how to design a PID controller when the desired pole locations are provided.
% Plant transfer function
Gp = tf(1, [1 3 3 1])
% Define the desired poles for the upright configuration
p = [-2 -3 -4];
% Convert Plant TF to Canonical-Controllable SS
sys = ss(Gp);
sys = compreal(sys, 'c');
A = sys.A'; % state matrix
B = sys.C'; % input matrix
C = sys.B'; % output matrix
% Calculating the optimum gain matrix based on desired poles
K = place(A, B, p);
K = round(K, 4)
% Desired Control System
Csys = ss(A - B*K, -prod(p)*B, C, 0*C*B);
% Control Design using Reverse Engineering
[num1, den1] = tfdata(Csys, 'v');
Gcp = tf(num1(end), [den1(1:3) 0]);
Gc = minreal(Gcp/Gp)
zero(Gc); % 24*(s + 1)*(s + 1)*(s + 1)
pole(Gc); % s*(s^2 + 9*s + 26)
% Filter design
Gf = 24*tf([1 1], [1 9 26]) % 24*(s + 1)/(s^2 + 9*s + 26)
% PID Controller
Gpid = minreal(Gc/Gf, 1e-4) % transfer function form
[num2, den2] = tfdata(Gpid, 'v');
Kp = round(num2(2), 4);
Ki = round(num2(3), 4);
Kd = round(num2(1), 4);
Gpid = pid(Kp, Ki, Kd) % same as (s^2 + 2*s + 1)/s
% Closed-loop transfer function, with Gc = Gpid*Gf
Gcl = minreal(feedback(Gpid*Gf*Gp, 1), 1e-4)
% Check if Gcl poles are placed at desired locations
pole(Gcl)
% Plot the closed-loop step response
step(Gcl, 10), grid on
カテゴリ
ヘルプ センター および File Exchange で Stability Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





