Reference tracking behavior in Simulink - Time & Space Complexity
We want to understand how the time needed to track a reference signal changes as the input size grows in a Simulink model.
How does the system's work increase when the reference signal or model size increases?
Analyze the time complexity of the following Simulink reference tracking setup.
// Simulink blocks pseudocode
ReferenceSignal = StepInput(t);
Error = ReferenceSignal - Output;
Controller = PID(Error);
Output = Plant(Controller);
This code models a system tracking a step reference signal using a PID controller and a plant block.
Look for repeated calculations or updates in the model.
- Primary operation: The PID controller updates its output every simulation step based on the error.
- How many times: Once per simulation time step, repeated for all time steps in the simulation.
The number of operations grows with the number of simulation steps.
| Input Size (n = simulation steps) | Approx. Operations |
|---|---|
| 10 | 10 PID updates |
| 100 | 100 PID updates |
| 1000 | 1000 PID updates |
Pattern observation: The work grows linearly as the number of simulation steps increases.
Time Complexity: O(n)
This means the time to track the reference grows directly in proportion to the number of simulation steps.
[X] Wrong: "The time to track the reference stays the same no matter how long the simulation runs."
[OK] Correct: Each simulation step requires the controller to update, so more steps mean more work.
Understanding how simulation time affects computation helps you design efficient control systems and predict performance in real projects.
"What if the controller used a more complex algorithm that depends on past states? How would the time complexity change?"
Practice
Solution
Step 1: Understand the goal of reference tracking
Reference tracking means the system output should follow or match a given target or reference signal.Step 2: Identify the correct purpose
Among the options, only making the system output follow a target signal matches the definition.Final Answer:
Make the system output follow a desired target signal -> Option BQuick Check:
Reference tracking = follow target signal [OK]
- Confusing reference tracking with speed optimization
- Thinking it reduces model size
- Assuming it generates random outputs
Solution
Step 1: Identify blocks that provide input signals
The Step block generates a step input signal, often used as a reference or target signal in tracking problems.Step 2: Eliminate other blocks
Gain modifies signals, Scope displays signals, Integrator integrates signals but does not generate reference inputs.Final Answer:
Step block -> Option AQuick Check:
Reference input = Step block [OK]
- Choosing Scope which only displays signals
- Confusing Gain with input generation
- Selecting Integrator which processes signals, not inputs
Solution
Step 1: Understand the system blocks
The Step block provides a sudden change (step input). The PID controller tries to reduce error between output and reference. The Transfer Function models the plant dynamics.Step 2: Predict output behavior
The output will try to follow the step input but may show delay and overshoot due to plant and controller dynamics.Final Answer:
Output will follow the step input with some delay and overshoot -> Option DQuick Check:
PID + plant = follow step with delay [OK]
- Assuming output stays zero without input
- Thinking output is random noise
- Confusing output with integral of input
Solution
Step 1: Identify cause of poor tracking
If output never reaches reference, controller gain may be too low to correct error effectively.Step 2: Choose appropriate fix
Increasing proportional gain makes controller respond stronger to error, improving tracking.Final Answer:
Increase the PID controller's proportional gain -> Option AQuick Check:
Better tracking = higher proportional gain [OK]
- Removing Step block removes reference signal
- Adding Scope only visualizes, doesn't fix
- Reducing stop time cuts simulation short
Solution
Step 1: Understand sinusoidal tracking challenges
Tracking sinusoidal signals requires controller tuning to handle continuous changes and reduce steady-state error.Step 2: Identify best improvement method
Tuning PID gains and adding feedforward control helps anticipate reference changes, improving accuracy.Final Answer:
Tune PID gains to reduce steady-state error and add feedforward control -> Option CQuick Check:
Sinusoidal tracking = PID tuning + feedforward [OK]
- Using Step block only ignores sinusoidal reference
- Increasing stop time alone doesn't improve control
- Removing plant block breaks model
Ready to prove it?
Pass the test and this pattern moves unknown
