MATLAB: How to find plant given PID values, closed loop transfer function, and step response graph?

I was given a step response graph, and from it, obtained a transfer function. The loop includes a plant and a PID controller, and I know the PID values that produced the output graph. I verified that the transfer function I found was correct by applying a step input, and the output graph matches the one I saw.

My code looks like this:

T = tf([.00248,-.00011,.000163],[1,.01,.00041])%plant and controller(P*C) with feedback
C = pid(2.5,0.5,0.1)%PID values
%T = feedback(C*plant,1)%need to find plant
step(T)

From this, I need to find the plant transfer function so that i can use it to find the optimal PID values instead of the ones it is using now.

Upvotes: 1

Views: 1461

Answers (1)

am304
am304

Reputation: 13876

If you look at the control loop with unity feedback:

enter image description here

You have for the closed-loop transfer function (that's your T):

Y(s) / U(s) = P*C / (1 + P*C) = T

If you reverse the relationship, you can express P as a function of C and T:

P = T / (C * (1-T))

In MATLAB, I would combine this with the use of the function minreal to obtain a minimum realisation of the transfer function:

>> T = tf([.00248,-.00011,.000163],[1,.01,.00041])

Transfer function 'T' from input 'u1' to output ...

      0.00248 s^2 - 0.00011 s + 0.000163
 y1:  ----------------------------------
            s^2 + 0.01 s + 0.00041

Continuous-time model.
>> C = pid(2.5,0.5,0.1)

Transfer function 'C' from input 'u1' to output ...

      0.1 s^2 + 2.5 s + 0.5
 y1:  ---------------------
                s

Continuous-time model.
>> P = minreal(T / (C * (1-T)))

Transfer function 'P' from input 'u1' to output ...

           0.02486 s^3 - 0.001103 s^2 + 0.001634 s
 y1:  --------------------------------------------------
      s^4 + 25.01 s^3 + 5.254 s^2 + 0.05687 s + 0.001238

Continuous-time model.

Upvotes: 2

Related Questions