Different results between Step and Stepinfo
13 views (last 30 days)
Show older comments
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?
0 Comments
Answers (2)
Vidhi Agarwal
on 22 Feb 2024
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.
0 Comments
Sam Chak
on 22 Feb 2024
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)
%% Steady-state response (need this in Approach #2)
ssr = dcgain(TS_3)
%% 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
%% Plot results
step(TS_3), hold on
plot(t3_2, y3), grid on
0 Comments
See Also
Categories
Find more on Time and Frequency Domain Analysis 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!