how can i solve this problem Undefined function or variable 'getPIDLoopResponse'
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Walter Roberson
am 28 Mär. 2025
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 Kommentare
Sam Chak
am 29 Mär. 2025
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 Kommentare
Siehe auch
Kategorien
Mehr zu PID Controller Tuning finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
