-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrootlocus_PI_tuning.m
More file actions
45 lines (35 loc) · 1.24 KB
/
rootlocus_PI_tuning.m
File metadata and controls
45 lines (35 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
clear all;
clc;
% Define the plant constant
G_v = 0.2159;
% Define the range for proportional and integral gains
Kp_v = 0.1:0.5:5; % Proportional gains for velocity
Ki_v = [0.5, 1, 1.5]; % Selected integral gains for velocity
% Initialize figure
figure;
hold on;
% Loop through Ki values to generate root locus for each
for Ki = Ki_v
num_v = [G_v * Kp_v, G_v * Ki]; % Numerator of transfer function
den_v = [1, G_v * Kp_v, G_v * Ki]; % Denominator of transfer function
rlocus(tf(num_v, den_v)); % Plot root locus
end
title('Root Locus for Velocity Control with Selected K_i');
grid on;
% Define the plant constant
G_w = 0.238;
% Define the range for proportional and integral gains
Kp_w = 0.1:0.5:5; % Proportional gains for turning rate
Ki_w = [0.5, 1, 1.5]; % Selected integral gains for turning rate
% Initialize figure
figure;
hold on;
% Loop through Ki values to generate root locus for each
for Ki = Ki_w
num_w = [G_w * Kp_w, G_w * Ki]; % Numerator of transfer function
den_w = [1, G_w * Kp_w, G_w * Ki]; % Denominator of transfer function
rlocus(tf(num_w, den_w)); % Plot root locus
end
title('Root Locus for Turning Rate Control with Selected K_i');
grid on;
hold off;