how can i solve this problem Undefined function or variable 'getPIDLoopResponse'
5 次查看(过去 30 天)
显示 更早的评论
G = tf(1,[1 1 1])
C = pidtune(G,'PI')
Tref = getPIDLoopResponse(C,G,"closed-loop");
Tdist = getPIDLoopResponse(C,G,"input-disturbance");
step(Tref,Tdist)
legend("Reference Tracking","Disturbance Rejection")
0 个评论
回答(2 个)
Walter Roberson
2025-3-28
getPIDLoopResponse() is part of the Control System Toolbox from R2019a and later.
The fact that tf() and pidtune() work for you but getPIDLoopResponse does not, suggest to me the possibility that you are using a release before R2019a.
0 个评论
Sam Chak
2025-3-29
Hi @Adnan
As mentioned by @Walter Roberson, you are likely using an older version of the Control System Toolbox before R2019a. Sometimes, newer functions are not necessarily better for beginners or experienced users, as these functions abstract away many of the mathematical details. This can make it easy to run an algorithm, but it may hinder the development of intuition regarding how it works.
In fact, it is analogous to pressing the Square Root button on a calculator. Most calculator users understand what it is, but they may not know how to compute it using pen and paper.

Here is the standard practice for control engineers prior to the introduction of the getPIDLoopResponse() function.
%% plant
G = tf(1, [1 1 1])
%% controller
C = pidtune(G,'PIDF')
%% closed-loop TF subject to reference input (R2019a or newer)
Tref1 = getPIDLoopResponse(C, G, "closed-loop");
%% closed-loop TF subject to disturbance input (R2019a or newer)
Tdist1 = getPIDLoopResponse(C, G, "input-disturbance");
%% closed-loop TF subject to reference input (before R2019a)
Tref2 = feedback(C*G, 1)
%% closed-loop TF subject to disturbance input (before R2019a)
Tdist2 = feedback(G, C)
%% step responses
tl = tiledlayout(2, 1, 'TileSpacing', 'Compact');
nexttile
step(Tref1, Tdist1), grid on
title('Step responses using getPIDLoopResponse()')
legend("Reference Tracking", "Disturbance Rejection", 'location', 'east')
nexttile
step(Tref2, Tdist2), grid on
title('Step responses using feedback()')
legend("Reference Tracking", "Disturbance Rejection", 'location', 'east')
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!
