how to apply single controller to multiple systems
1 view (last 30 days)
Show older comments
how to apply single controller to multiple systems and see the response in same plot? share the matlab command.
0 Comments
Accepted Answer
Sam Chak
on 7 Sep 2023
Hi @K Kalanithi
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')
More Answers (0)
See Also
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!