how to apply single controller to multiple systems

1 Ansicht (letzte 30 Tage)
K Kalanithi
K Kalanithi am 6 Sep. 2023
Kommentiert: K Kalanithi am 7 Sep. 2023
how to apply single controller to multiple systems and see the response in same plot? share the matlab command.

Akzeptierte Antwort

Sam Chak
Sam Chak am 7 Sep. 2023
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')

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by