How to compute control system's performance parameters?

14 views (last 30 days)
Hello everyone.
J = 0.2;
b = 0.1;
K = 0.2;
R = 10;
L = 5;
s = tf('s');
p = K/((J*s+b)*(L*s+R)+K^2);
step(p,200)
[y,t]=step(p,200);
stepinfo(y)
With the following code, I want to measure the rise time. Using the stepinfo command, this is what pops in my command window :
ans =
struct with fields:
RiseTime: 94.5571 %%Rise time
SettlingTime: 172.5924
SettlingMin: 0.1735
SettlingMax: 0.1923
Overshoot: 0
Undershoot: 0
Peak: 0.1923
PeakTime: 1378
But when I check the parameters using the step response graph, the answer is different.
So, why am I getting two different rise times? Any solution?
Thanks in advance!
  1 Comment
Muhammad
Muhammad on 21 Sep 2023
%In the following program, peak is crossing the limit "2" where as it should be below "2".
clc
clear
N=zeros(1,2000);
K=zeros(1,2000);%redefined N & K to fix the error
Gr=[];
Ga=[];
e0=0.2;
gamass=0.05;
gamaL=0.05;
numda=.1;
numdas=.1;
delta=1;
em=0.1;
po=1;
fid=fopen('file.xls','a');
for n=1:2000
e=-0.5+n*1/2000;
N(1,n)=e;
A=[e-e0, 0,numdas/sqrt(2),numdas/sqrt(2);
0, e+e0, -numda/sqrt(2),-numda/sqrt(2);
numdas/sqrt(2), -numdas/sqrt(2), e-em, 0;
numdas/sqrt(2), -numdas/sqrt(2), 0, e+em;];
B=-(1i/2)*[gamaL,0,0,0;
0,gamaL,0,0;
0,0,0,0;
0,0,0,0;];
if abs(e)>delta;
ru=abs(e)/sqrt(delta*delta-e*e);
elseif abs(e)==delta
ru=1
else
ru=abs(e)/(i*sqrt(delta*delta-e*e));
end
ru=abs(e)/1i*sqrt(delta*delta-e*e);
C=-(1i/2)*[1,-delta/e,0,0;
-delta/e,1,0,0;
0,0,0,0;
0,0,0,0;];
D=gamass*ru*C;
F=B+D;
E=A-F;
Gr=(inv(E));
Ga=conj(Gr);%Gr';
G= Gr(1,2)*gamaL*Ga(2,1)*gamaL+...
Gr(1,4)*gamaL*Ga(4,1)*gamaL+ ...
Gr(3,2)*gamaL*Ga(2,3)*gamaL+ ...
Gr(3,4)*gamaL*Ga(4,3)*gamaL;
K(1,n)=G;
fprintf(fid,'%10.6f %10.6f\n',e ,G);
end
fclose(fid);
figure
plot(N,K);
hold on
axis([0.1,0.5,0.0,2.0]);
xlabel('e');
ylabel('G');

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 31 Jul 2020
You are not calling stepinfo correctlly.
stepinfo(p)
produces:
ans =
struct with fields:
RiseTime: 4.4144
SettlingTime: 8.0108
SettlingMin: 0.1735
SettlingMax: 0.1923
Overshoot: 0
Undershoot: 0
Peak: 0.1923
PeakTime: 23.2961
.

More Answers (3)

Paul
Paul on 31 Jul 2020
Edited: Paul on 1 Aug 2020
stepinfo(y,t)
If you want to use the output from step. Note that stepinfo using the transfer function gives a peculiar result for PeakTime:
>> sy=stepinfo(y,t)
sy =
struct with fields:
RiseTime: 4.414431198715340e+00
SettlingTime: 8.010849818943374e+00
SettlingMin: 1.734586244553206e-01
SettlingMax: 1.923076923076916e-01
Overshoot: 0
Undershoot: 0
Peak: 1.923076923076916e-01
PeakTime: 6.428571428571429e+01
>> sp=stepinfo(p)
sp =
struct with fields:
RiseTime: 4.414430957167118e+00
SettlingTime: 8.010849940068825e+00
SettlingMin: 1.734589587177580e-01
SettlingMax: 1.923064745779809e-01
Overshoot: 0
Undershoot: 0
Peak: 1.923064745779809e-01
PeakTime: 2.329614202821439e+01
PeakTime from stepinfo(y,t) is just taking the time at the first value that is the maximum of y. Maybe it should take the time at the last value that is the max?
>> [ymax,imax]=max(y);
>> t(imax)
ans =
6.428571428571429e+01
>> all(y(imax:end)==ymax)
ans =
logical
1
It appears that stepinfo(p) works by first generating a step response yy for some time vector tt and then essentially calling stepinfo(yy,tt). In this case, the time vector used by stepinfo(yy,tt) ended at the PeakTime, which also corresponds to max(yy).
I'm suprised by this result for this p. I would've thought that stepinfo would catch the case of all real, negative poles and then just compute the peak value as the final value (which can be determined without generating yy) and assigning the PeakTime = inf.

Muhammad
Muhammad on 21 Sep 2023
how to control conductance below "2" along yaxis in matlab program a normal-metal/quantum-dot/superconductor system with coupled Majorana bound states? I am working on it from six months but failed.

Muhammad
Muhammad on 22 Sep 2023
%In the following program, peak is crossing the limit "2" where as it should be below "2".
clc
clear
N=zeros(1,2000);
K=zeros(1,2000);%redefined N & K to fix the error
Gr=[];
Ga=[];
e0=0.2;
gamass=0.05;
gamaL=0.05;
numda=.1;
numdas=.1;
delta=1;
em=0.1;
po=1;
fid=fopen('file.xls','a');
for n=1:2000
e=-0.5+n*1/2000;
N(1,n)=e;
A=[e-e0, 0,numdas/sqrt(2),numdas/sqrt(2);
0, e+e0, -numda/sqrt(2),-numda/sqrt(2);
numdas/sqrt(2), -numdas/sqrt(2), e-em, 0;
numdas/sqrt(2), -numdas/sqrt(2), 0, e+em;];
B=-(1i/2)*[gamaL,0,0,0;
0,gamaL,0,0;
0,0,0,0;
0,0,0,0;];
if abs(e)>delta;
ru=abs(e)/sqrt(delta*delta-e*e);
elseif abs(e)==delta
ru=1
else
ru=abs(e)/(i*sqrt(delta*delta-e*e));
end
ru=abs(e)/1i*sqrt(delta*delta-e*e);
C=-(1i/2)*[1,-delta/e,0,0;
-delta/e,1,0,0;
0,0,0,0;
0,0,0,0;];
D=gamass*ru*C;
F=B+D;
E=A-F;
Gr=(inv(E));
Ga=conj(Gr);%Gr';
G= Gr(1,2)*gamaL*Ga(2,1)*gamaL+...
Gr(1,4)*gamaL*Ga(4,1)*gamaL+ ...
Gr(3,2)*gamaL*Ga(2,3)*gamaL+ ...
Gr(3,4)*gamaL*Ga(4,3)*gamaL;
K(1,n)=G;
fprintf(fid,'%10.6f %10.6f\n',e ,G);
end
fclose(fid);
figure
plot(N,K);
hold on
axis([0.1,0.5,0.0,2.0]);
xlabel('e');
ylabel('G');
why the peak is crossing 2 limit along y-axis? while matrics are correct?
So, why am I getting peak upto 4.5? Any solution, please guide?
Thanks in advance you guys

Categories

Find more on Argument Definitions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!