how can i solve this problem Undefined function or variable 'getPIDLoopResponse'

5 Ansichten (letzte 30 Tage)
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")

Antworten (2)

Walter Roberson
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.

Sam Chak
Sam Chak am 29 Mär. 2025
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])
G = 1 ----------- s^2 + s + 1 Continuous-time transfer function.
%% controller
C = pidtune(G,'PIDF')
C = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = 2.09, Ki = 1.19, Kd = 0.91, Tf = 0.00549 Continuous-time PIDF controller in parallel form.
%% 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)
Tref2 = 167.8 s^2 + 381.4 s + 216.7 --------------------------------------------- s^4 + 183.1 s^3 + 350.9 s^2 + 563.5 s + 216.7 Continuous-time transfer function.
%% closed-loop TF subject to disturbance input (before R2019a)
Tdist2 = feedback(G, C)
Tdist2 = s^2 + 182.1 s --------------------------------------------- s^4 + 183.1 s^3 + 350.9 s^2 + 563.5 s + 216.7 Continuous-time transfer function.
%% 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')

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by