0
\$\begingroup\$

I have step response in open loop of my model that i stored in workspace and I want to use Matlab to obtain the: T time constant, L dead time and A (see figure below).is there a command for that like the stepinfo? enter image description here I have used it and as I am using a plant, I simulated the plant with step input and I did save the output Vout in timeseries as you showed me previously and made this script:

time=Vout.Time;  % x
Y=Vout.Data;   % y
For K, use the final value of Y
K = Y(end);
L_index = find(Y>=.05*K,1); 
L = time(L_index);
T_index = find(Y>=(1-exp(-1))*K,1);
T = time(T_index);
D = diff(Y)./diff(time);
inflex = find(diff(D)./diff(time(1:end-1))<0,1);
A = D(inflex)*time(inflex)-Y(inflex);

tangent = D(inflex)*time - A;
plot(time,Y), hold on, plot(time,tangent), plot(L,Y(L_index),'*'), 
plot(T,Y(T_index),'*') 

it calculated every parameters (L,T and A) but the result look like: enter image description here description here does the modification i included are right despite not seeing the tangent?

\$\endgroup\$
  • \$\begingroup\$ I don't believe there is. For L and T, use amplitude thresholding. For A, you can estimate inflection point by the zero-crossing when using diff twice, then get the tangential line equation at the point. For Kp use final values. \$\endgroup\$ – Vicente Cunha May 24 '18 at 10:17
  • \$\begingroup\$ actually,I don't know how to use amplitude thresholding as it shows(after googling) about finding peaks or do you mean findind the 90% of the curve then 10% and trace it? if you can please develop more for the T,L and A I will be gratefull? \$\endgroup\$ – Yaakov May 24 '18 at 10:35
3
\$\begingroup\$

An example system and its step response:

s = tf('s');
SYS = 1/(s^2+s+1);
[Y,time] = step(SYS);

For K, use the final value of Y.

K = Y(end);

For L and T, use an amplitude threshold criteria. Here I consider L to be when amplitude goes above 5% the final value, and T when it goes above 63%.

L_index = find(Y>=.05*K,1);
L = time(L_index);
T_index = find(Y>=(1-exp(-1))*K,1);
T = time(T_index);

Use diff twice to detect the inflexion point, determine tangential line slope and the negative of its linear coefficient is equal to A.

D = diff(Y)./diff(time);
inflex = find(diff(D)./diff(time(1:end-1))<0,1);
A = D(inflex)*time(inflex)-Y(inflex);

Now a plot to prove all is in order.

tangent = D(inflex)*time - A;
step(SYS), hold on, plot(time,tangent), plot(L,Y(L_index),'*'), plot(T,Y(T_index),'*')

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.