Azzera filtri
Azzera filtri

How to get 2% and 5% settling time from simulink?

71 visualizzazioni (ultimi 30 giorni)
Daniel
Daniel il 22 Feb 2024
Commentato: Sam Chak il 22 Feb 2024
Hello,
I am simulating a simple open loop control system, as part of it I need to output the 2% and 5% settling time from simulink to check against my matlab and hand calc results. Can anyone help me with outputting the 2% and 5% settling time on simulink?

Risposte (2)

Sam Chak
Sam Chak il 22 Feb 2024
Modificato: Sam Chak il 22 Feb 2024
Below, you'll find the calculation for the settling time based on the 5% criterion:
%% System
zeta= 1/2;
wn = 1;
sys = tf(1, [1 2*zeta*wn wn^2])
sys = 1 ----------- s^2 + s + 1 Continuous-time transfer function.
%% Assume that response data {Time t, Output y} is sent to Workspace
[y, t] = step(sys);
%% Settling time (5% criterion)
yfinal = 1; % steady-state response value
S = stepinfo(y, t, yfinal, 'SettlingTimeThreshold', 5/100);
Ts = S.SettlingTime
Ts = 5.2895
%% Plot result
plot(t, y), grid on
xline(Ts, '--', 'Settling time', 'LabelVerticalAlignment', 'bottom'),
yline(1.05, '--', '+5% threshold')
xlabel t, ylabel y(t)
Update: Demo using Simulink model
%% ----- This part can be skipped ----
load("responseData.mat");
G = tf(1, [1 8.52 5.3 26]);
step(G), grid on
% ------------------------------------
%% Computation of settling times based on 2% and 5% criteria
yfinal = 1/26; % steady-state response value
S2 = stepinfo(out.out, out.t, yfinal);
Ts2 = S2.SettlingTime % 2% criterion
Ts2 = 28.8686
S5 = stepinfo(out.out, out.t, yfinal, 'SettlingTimeThreshold', 5/100);
Ts5 = S5.SettlingTime % 5% criterion
Ts5 = 21.7743
  7 Commenti
Daniel
Daniel il 22 Feb 2024
Thanks for the help. I dont suppose you know how to find the damping ratio from simulink? I cant seem to find how to do it.
Sam Chak
Sam Chak il 22 Feb 2024
If you have already determined the system's transfer function, you can directly calculate the damping ratio using the 'damp()' command in MATLAB. Do you find the demonstrations for getting the settling time and the damping ratio helpful?
G = tf(1, [1 8.52 5.3 26])
G = 1 --------------------------- s^3 + 8.52 s^2 + 5.3 s + 26 Continuous-time transfer function.
damp(G)
Pole Damping Frequency Time Constant (rad/seconds) (seconds) -1.30e-01 + 1.77e+00i 7.34e-02 1.77e+00 7.68e+00 -1.30e-01 - 1.77e+00i 7.34e-02 1.77e+00 7.68e+00 -8.26e+00 1.00e+00 8.26e+00 1.21e-01

Accedi per commentare.


Paul
Paul il 22 Feb 2024
Hi Daniel,
I'm interpreting your question to mean that you have a Simulink model of the system and in Simulink you stimulate the system with a step input and wish to compute the settling time of the output, which is logged by a To Worspace block or something similar.
Once you the the output in the base workspace, you can use stepinfo to compute its settling time.
  1 Commento
Daniel
Daniel il 22 Feb 2024
Hello,
Yes I have a simulink model of the system, you can see the system in the picture below.
I have done stepinfo however it only provides one settling value, I need to find the values for 2% and 5% settling times.
Hope this makes sense.

Accedi per commentare.

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by