0

Is there a way in Matlab to take a transfer function, define H (closed loop system) and sweep all values of Kp and Kd that allow the system to be stable?

clear all
clc
close all
s = tf('s');
Gs = tf(0.001667,([1 12.04 20.52 0.8342]));
H = -1;
subplot(3,1,1)
step(feedback(Gs,H))
hold on
grid on
title('Step serponse without a PD controler')
Kp = 1;  %-147700.5<Kp<2500
Kd = 0;
subplot(3,1,2)
C = pid(Kp,0,Kd);
T = feedback(C*Gs,H);
t = 0:0.01:140;
step(T,t)
grid on
title('Step response with a PD controler')
subplot(3,1,3)
rlocus(T)
title('Root locus to check for stability')
grid on
stability = isstable(T)

I'm aware that I can use a Routh Hurwitz stability test to find range of Kp and Kd values that satisfy stability but is it possible to do this in Matlab without Routh Hurwitz table? I'm not trying to tune this system for a specific function - yet.

Jonas
  • 121,568
  • 97
  • 310
  • 388
user2924294
  • 37
  • 1
  • 10

1 Answers1

0

Not that I know of. Your best bet is to use pidTuner to tune the PID gains:

pidtuner(Gs,'pd') % open PID tuner for plant Gs with PD controller

or

pidtuner(Gs,'pdf') % open PID tuner for plant Gs with PD controller & approximate derivative
am304
  • 13,758
  • 2
  • 22
  • 40