Different results between Step and Stepinfo

조회 수: 12 (최근 30일)
Gerard Carroll
Gerard Carroll 2021년 6월 3일
답변: Sam Chak 2024년 2월 22일
Hi,
I'm running R2020b update 5.
This is my code:
s = tf('s');
G3 = (25/5.05)/(s^3+(101/5.05)*s^2+(505.2/5.05)*s+100/5.05);
roots_3 = roots([1 101/5.05 505.2/5.05 100/5.05]);
G3_c = 500.789*((s-roots_3(2))*(s+.0273103))/((s+29.356)*(s+0.01));
G3_final = G3*G3_c;
TS_3 = feedback(G3_final,1);
[y3,t3_2] = step(TS_3);
si = stepinfo(y3,t3_2);
step(TS_3)
This gives me this graph:
However, my stepinfo gives:
RiseTime: 0.1871
SettlingTime: 1.0105
SettlingMin: 0.9213
SettlingMax: 1.1644
Overshoot: 18.5698
Undershoot: 0
Peak: 1.1644
PeakTime: 0.4386
These are very different. Any help?

답변 (2개)

Vidhi Agarwal
Vidhi Agarwal 2024년 2월 22일
Hi Gerard,
I understand you encountering discrepancy between the values of percentage overshoot in step-response graph and stepinfo() data.
This is occurring because the response has not fully settled here due to the near cancellation of the slow pole/zero pair at s=-0.027, using the (y,t) data out of STEP to compute the characteristics will be inaccuracies. To fix this, you can either use:
si = stepinfo(sys)
or specify a large enough final time for STEP:
[y,t] = step(TS_3,200);
si = stepinfo(y,t)
I hope this solves your problem.

Sam Chak
Sam Chak 2024년 2월 22일
The main reason behind the difference in the step-response characteristics between Approach 1 (from Transfer function) and Approach 2 (from Response data) is that you didn't compare them in a consistent manner. Additionally, it's worth noting that the computation of response characteristics has changed since R2021b.
To ensure accurate comparison, here's the correct procedure:
%% Transfer function
s = tf('s');
G3 = (25/5.05)/(s^3+(101/5.05)*s^2+(505.2/5.05)*s+100/5.05);
roots_3 = roots([1 101/5.05 505.2/5.05 100/5.05]);
G3_c = 500.789*((s-roots_3(2))*(s+.0273103))/((s+29.356)*(s+0.01));
G3_final = G3*G3_c;
TS_3 = feedback(G3_final, 1)
TS_3 = 2479 s^2 + 2.11e04 s + 574.5 ----------------------------------------------------------- s^5 + 49.37 s^4 + 687.7 s^3 + 5443 s^2 + 2.172e04 s + 580.3 Continuous-time transfer function.
%% Steady-state response (need this in Approach #2)
ssr = dcgain(TS_3)
ssr = 0.9900
%% Approach 1: Obtain step-response characteristics from transfer function
si_1 = stepinfo(TS_3);
%% Approach 2: Obtain step-response characteristics from the response data
[y3, t3_2] = step(TS_3);
si_2 = stepinfo(y3, t3_2, ssr);
%% Comparing the characteristics between both approaches
stepInfoTable = struct2table([si_1, si_2]);
stepInfoTable = removevars(stepInfoTable, {...
'SettlingMin', 'SettlingMax', 'Undershoot', 'PeakTime'});
stepInfoTable.Properties.RowNames = {'Approach 1', 'Approach 2'};
stepInfoTable
stepInfoTable = 2×5 table
RiseTime TransientTime SettlingTime Overshoot Peak ________ _____________ ____________ _________ ______ Approach 1 0.18887 1.0563 1.0563 17.614 1.1644 Approach 2 0.18887 1.0563 1.0563 17.614 1.1644
%% Plot results
step(TS_3), hold on
plot(t3_2, y3), grid on

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by