Steady-state error analysis in Simulink - Time & Space Complexity
We want to understand how the time it takes to analyze steady-state error grows as the system size or input changes.
How does the analysis effort increase when the system or input gets bigger?
Analyze the time complexity of the following Simulink model snippet for steady-state error calculation.
% Simulink steady-state error calculation
sys = tf([1],[1 3 2]);
input = stepData;
time = linspace(0,10,length(input));
output = lsim(sys, input, time);
error = input - output;
steady_state_error = error(end);
This code simulates the system response to a step input and calculates the steady-state error as the difference at the last time point.
Look for repeated calculations or loops in the simulation.
- Primary operation: Simulating system response over time steps.
- How many times: Once per time step in the input signal.
The simulation runs once for each time step, so more time points mean more calculations.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 simulations |
| 100 | 100 simulations |
| 1000 | 1000 simulations |
Pattern observation: The number of operations grows directly with the number of time steps.
Time Complexity: O(n)
This means the time to analyze steady-state error grows linearly with the number of time steps simulated.
[X] Wrong: "The steady-state error calculation is instant and does not depend on input size."
[OK] Correct: The calculation depends on simulating the system over time, so more time points mean more work.
Understanding how simulation time grows helps you explain system analysis efficiency clearly and confidently.
"What if we used a more complex system with multiple states? How would the time complexity change?"
Practice
Solution
Step 1: Understand steady-state error meaning
Steady-state error measures how close the system output is to the input after settling.Step 2: Compare options with definition
Only The difference between the desired input and the actual output after the system settles correctly describes this difference after settling.Final Answer:
The difference between the desired input and the actual output after the system settles -> Option CQuick Check:
Steady-state error = final input - final output [OK]
- Confusing steady-state error with response time
- Thinking it measures initial delay
- Mixing it with peak output value
Solution
Step 1: Identify block function
The Sum block calculates the difference between signals, useful for error measurement.Step 2: Match block to steady-state error
Steady-state error is the difference between input and output, so Sum block is used.Final Answer:
Sum block -> Option BQuick Check:
Sum block calculates error difference [OK]
- Choosing Scope block which only displays signals
- Selecting Gain block which scales signals
- Confusing Integrator block with error calculation
sys = tf([1], [1 3 2]); y = step(sys, 10); steady_error = abs(1 - y(end)); disp(steady_error);
What is the output of
steady_error?Solution
Step 1: Analyze transfer function and step response
The transfer function G(s) = 1/(s^2 + 3s + 2) has DC gain G(0) = 1/2 = 0.5. Poles at -1 and -2 ensure stability, step response settles at 0.5.Step 2: Calculate steady-state error
Steady-state error = abs(1 - final output) = |1 - 0.5| = 0.5.Final Answer:
0.5 -> Option AQuick Check:
DC gain = 1/2, error = |1 - 0.5| = 0.5 [OK]
- Miscalculating DC gain as 1 instead of 1/2
- Confusing transient response with steady-state
- Thinking all stable systems have zero steady-state error
sys = tf([2], [1 2 1]); y = step(sys, 10); steady_error = 1 - y(end);
Why might this code give a wrong steady-state error value?
Solution
Step 1: Check error calculation formula
The code calculates error as 1 - y(end) without absolute value, which can be negative.Step 2: Understand steady-state error definition
Steady-state error should be absolute difference to represent magnitude correctly.Final Answer:
Because it does not take the absolute value of the error -> Option DQuick Check:
Error magnitude needs absolute value [OK]
- Ignoring sign of error
- Assuming step time affects error calculation
- Misdefining transfer function numerator
G(s) = 1/(s+1). Which modification will most effectively reduce steady-state error to a step input?Solution
Step 1: Understand steady-state error for type 0 system
G(s) = 1/(s+1) is type 0, which has nonzero steady-state error to step input.Step 2: Effect of adding integrator
Adding an integrator (1/s) increases system type to 1, eliminating steady-state error for step inputs.Final Answer:
Add an integrator in the forward path -> Option AQuick Check:
Integrator reduces steady-state error to zero for step input [OK]
- Thinking gain increase alone removes steady-state error
- Confusing differentiator effect with error reduction
- Adding delay which does not affect steady-state error
Ready to prove it?
Pass the test and this pattern moves unknown
