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.
댓글 수: 0
채택된 답변
Sam Chak
2023년 9월 7일
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')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 PID Controller Tuning에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!