how to apply single controller to multiple systems

1 次查看(过去 30 天)
how to apply single controller to multiple systems and see the response in same plot? share the matlab command.

采纳的回答

Sam Chak
Sam Chak 2023-9-7
Here is a relatively simple script demonstrating an example of how to plot all responses of multiple systems that share the same controller in a single plot, without using a for-loop iterative technique.
% Multiple plants
Gp1 = tf(2, [1 0 0]);
Gp2 = tf(3, [1 0 0]);
Gp3 = tf(4, [1 0 0]);
% A single controller
Gc = pid(0, 0, 2.3102, 0.178);
% Multiple closed-loop systems
Gcl1 = feedback(series(Gc, Gp1), 1);
Gcl2 = feedback(series(Gc, Gp2), 1);
Gcl3 = feedback(series(Gc, Gp3), 1);
% Generating the responses
t = linspace(0, 5, 501);
y1 = step(Gcl1, t);
y2 = step(Gcl2, t);
y3 = step(Gcl3, t);
% Plotting all responses in a single plot
plot(t, [y1, y2, y3]), grid on
xlabel('Time (seconds)')
ylabel('Amplitude')
legend('Gcl_1', 'Gcl_2', 'Gcl_3')
title('Step Responses of Multiple Closed-loop Systems')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 PID Controller Tuning 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by