FUNCTION REFERENCE
pidtune
Tune a PID controller for a SISO plant by a documented phase-margin rule.
Tune a PID controller for a SISO plant by a documented phase-margin rule.
Syntax
[C,info] = pidtune(G,type)Syntax
[C,info] = pidtune(G,type,wc)Syntax
[C,info] = pidtune(G,type,opts)Syntax
[C,info] = pidtune(G,type,wc,opts)type is 'P', 'I', 'PI', 'PD', 'PDF', 'PID' or 'PIDF'. Returns a parallel pid object and info with fields Stable, CrossoverFrequency and PhaseMargin. opts comes from pidtuneOptions; its PhaseMargin (default 60 degrees) sets the target, and wc = [] keeps the default crossover. The gains differ from MATLAB's pidtune, which uses a different (unpublished) method. Rule used here: at the crossover wc the loop must satisfy abs(C(jwc)*G(jwc)) = 1 and angle = PhaseMargin - 180 degrees (-120 for the default 60). Integral types fix Ki = Kp*wc/10 (a 5.71 degree lag at wc), except PI with a given wc, which solves Kp and Ki for the target when the needed phase lies between -90 and 0 degrees; PDF and PIDF fix Tf = 1/(10*wc). P, I and PI have one free gain at the default wc: Kp (or Ki for I) gives abs(C*G) = 1, and the default wc is the frequency where the phase of G equals the target minus the controller's own phase (0 for P, -90 for I, -5.71 for PI), so the margin is exactly the target; with a given wc, P and I reach whatever margin results. PD, PDF, PID and PIDF solve Kp and Kd in closed form from the complex target; their default wc is where the phase of G is the target minus 30 degrees (-150 for a 60 degree margin). If the required phase never occurs, wc falls back to the gain crossover of G, then to 1 rad/s. The closed loop feedback(C*G,1) is checked; an unstable result (or one that needs negative gains) is an error.
Example
G=tf(1,[1 3 3 1]); [C,info]=pidtune(G,'PID')Example
[C,info]=pidtune(tf(1,[1 2 0]),'PI',0.5);Example
[C,info]=pidtune(tf(1,[1 3 3 1]),'PIDF',[],pidtuneOptions('PhaseMargin',45));Differences from MATLAB: different tuning method and gains; continuous SISO plants only; DesignFocus is accepted but does not change the design; no 2-DOF types; unstable results are errors instead of warnings.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.