Bird
Raised Fist0
Simulinkdata~10 mins

Why discrete-time matters for digital control in Simulink - Visual Breakdown

Choose your learning style10 modes available
Concept Flow - Why discrete-time matters for digital control
Physical System (Continuous)
↓
Sensor Measures Output
↓
Sample & Hold (Discrete Sampling)
↓
Digital Controller (Discrete-Time)
↓
Actuator Applies Control
↓
Physical System (Continuous)
This flow shows how a continuous physical system is controlled digitally by sampling its output at discrete times, processing it digitally, and applying control signals back to the system.
Execution Sample
Simulink
Ts = 0.1;
sys = tf([1], [1 1]);
d_sys = c2d(sys, Ts);
step(d_sys, 5);
This code converts a continuous system to discrete with sampling time Ts=0.1s and plots its step response over 5 seconds.
Execution Table
StepActionContinuous System OutputSampled Output (Discrete)Controller InputController Output
1System runs continuously0.0N/AN/AN/A
2Sample at t=0.1s0.0950.0950.0950.19
3Sample at t=0.2s0.1810.1810.1810.362
4Sample at t=0.3s0.2590.2590.2590.518
5Sample at t=0.4s0.3290.3290.3290.658
6Sample at t=0.5s0.3930.3930.3930.786
7Sample at t=0.6s0.4510.4510.4510.902
8Sample at t=0.7s0.5030.5030.5031.006
9Sample at t=0.8s0.5510.5510.5511.102
10Sample at t=0.9s0.5940.5940.5941.188
11Sample at t=1.0s0.6330.6330.6331.266
12End of simulationN/AN/AN/AN/A
💡 Simulation ends after 1 second with discrete samples controlling the system.
Variable Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6After 7After 8After 9After 10Final
Continuous Output0.00.0950.1810.2590.3290.3930.4510.5030.5510.5940.633N/A
Sampled OutputN/A0.0950.1810.2590.3290.3930.4510.5030.5510.5940.633N/A
Controller InputN/A0.0950.1810.2590.3290.3930.4510.5030.5510.5940.633N/A
Controller OutputN/A0.190.3620.5180.6580.7860.9021.0061.1021.1881.266N/A
Key Moments - 2 Insights
Why do we sample the continuous output instead of using it directly?
Because the digital controller works with discrete data, we must sample the continuous output at fixed intervals (see execution_table steps 2-11). Direct continuous signals cannot be processed digitally without sampling.
Why does the controller output update only at sampling times?
The controller output updates only when new sampled data arrives (discrete times), so it holds its value between samples (see variable_tracker for controller output changes only at sample steps).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 5, what is the sampled output value?
A0.259
B0.393
C0.329
D0.451
💡 Hint
Check the 'Sampled Output (Discrete)' column at step 5 in the execution_table.
At which step does the controller output first exceed 1.0?
AStep 8
BStep 9
CStep 7
DStep 10
💡 Hint
Look at the 'Controller Output' column in the execution_table and find when it passes 1.0.
If the sampling time Ts was doubled, how would the sampled output values change in the execution_table?
AThey would be sampled more frequently, so more rows with sampled outputs.
BThey would be sampled less frequently, so fewer rows with sampled outputs.
CSampling frequency does not affect sampled output values.
DSampled outputs would be continuous values.
💡 Hint
Sampling time controls how often samples are taken, affecting the number of discrete samples (see concept_flow and execution_table).
Concept Snapshot
Digital control uses discrete-time signals.
Continuous system output is sampled at fixed intervals.
Digital controller processes these samples.
Controller output updates only at sample times.
Sampling time affects control responsiveness.
Discrete-time control bridges continuous systems and digital devices.
Full Transcript
In digital control, the continuous physical system is measured by sensors. These measurements are sampled at fixed intervals, creating discrete-time data. The digital controller uses these discrete samples to compute control actions. The controller output updates only at these discrete times and is held constant between samples. This process is essential because digital devices cannot process continuous signals directly. The sampling time determines how often the system is observed and controlled, affecting the system's performance and stability. The example code converts a continuous system to discrete with a sampling time of 0.1 seconds and shows the step response. The execution table traces the system output, sampled values, controller inputs, and outputs step-by-step, illustrating how discrete-time control works in practice.

Practice

(1/5)
1. Why is discrete-time important in digital control systems modeled in Simulink?
easy
A. Because discrete-time eliminates the need for sampling
B. Because continuous signals are easier to process digitally
C. Because it allows infinite precision in signal values
D. Because digital controllers update signals at fixed time intervals

Solution

  1. Step 1: Understand digital controller operation

    Digital controllers work by updating signals at fixed intervals, not continuously.
  2. Step 2: Connect discrete-time to Simulink modeling

    Simulink models this by using discrete blocks with sample times to represent these fixed updates.
  3. Final Answer:

    Because digital controllers update signals at fixed time intervals -> Option D
  4. Quick Check:

    Digital control = discrete updates [OK]
Hint: Digital control means fixed update times, not continuous [OK]
Common Mistakes:
  • Thinking digital control is continuous
  • Confusing sampling with elimination
  • Assuming infinite precision in digital signals
2. Which Simulink block parameter correctly sets the discrete sample time for a digital controller?
easy
A. Continuous sample time set to 0
B. Sample time set to a positive fixed value
C. Sample time set to -1 for inherited
D. Sample time set to infinity

Solution

  1. Step 1: Identify how discrete sample time is set

    Discrete blocks require a positive fixed sample time to update at intervals.
  2. Step 2: Evaluate options

    Setting sample time to 0 means continuous, -1 means inherited, infinity is invalid.
  3. Final Answer:

    Sample time set to a positive fixed value -> Option B
  4. Quick Check:

    Discrete sample time = positive value [OK]
Hint: Discrete sample time must be positive fixed number [OK]
Common Mistakes:
  • Using 0 which means continuous time
  • Using -1 which inherits sample time
  • Setting sample time to infinity
3. Given this Simulink discrete-time update code snippet:
y[k] = 0.5 * y[k-1] + u[k]

and input sequence u = [2, 4, 6], with initial y[0] = 0, what is y[3]?
medium
A. 8.5
B. 7.0
C. 9.5
D. 10.0

Solution

  1. Step 1: Calculate y[1], y[2], y[3] step-by-step

    y[1] = 0.5* y[0] + u[1] = 0.5*0 + 2 = 2
    y[2] = 0.5* y[1] + u[2] = 0.5*2 + 4 = 1 + 4 = 5
    y[3] = 0.5* y[2] + u[3] = 0.5*5 + 6 = 2.5 + 6 = 8.5
  2. Step 2: Verify calculations

    Check each step carefully to avoid off-by-one errors in indexing.
  3. Final Answer:

    8.5 -> Option A
  4. Quick Check:

    Discrete update sums to 8.5 [OK]
Hint: Calculate each step using previous output and input [OK]
Common Mistakes:
  • Mixing up indices k and k-1
  • Forgetting initial condition y[0]
  • Adding instead of multiplying coefficients
4. Identify the error in this Simulink discrete-time block setup:
Sample time = 0
Initial condition = 5

What is wrong?
medium
A. No error, setup is correct
B. Initial condition cannot be 5
C. Sample time 0 means continuous, not discrete
D. Sample time must be negative

Solution

  1. Step 1: Understand sample time meaning

    Sample time 0 means continuous time, not discrete updates.
  2. Step 2: Check initial condition validity

    Initial condition 5 is valid; no issue there.
  3. Final Answer:

    Sample time 0 means continuous, not discrete -> Option C
  4. Quick Check:

    Discrete sample time ≠ 0 [OK]
Hint: Sample time 0 means continuous, use positive for discrete [OK]
Common Mistakes:
  • Thinking initial condition causes error
  • Believing sample time can be zero for discrete
  • Ignoring sample time meaning
5. You want to design a digital controller in Simulink that samples input every 0.1 seconds and holds output constant between samples. Which setup correctly models this behavior?
hard
A. Use a discrete block with sample time 0.1 and a Zero-Order Hold block
B. Use a continuous block with sample time 0 and a Unit Delay block
C. Use a discrete block with sample time -1 and no hold block
D. Use a continuous block with sample time 0.1 and a Zero-Order Hold block

Solution

  1. Step 1: Identify correct sample time setting

    Discrete block with sample time 0.1 means updates every 0.1 seconds.
  2. Step 2: Understand output holding

    Zero-Order Hold block keeps output constant between samples, matching requirement.
  3. Final Answer:

    Use a discrete block with sample time 0.1 and a Zero-Order Hold block -> Option A
  4. Quick Check:

    Discrete sample + hold = correct model [OK]
Hint: Discrete block + Zero-Order Hold models sampled and held output [OK]
Common Mistakes:
  • Using continuous block for discrete sampling
  • Omitting Zero-Order Hold block
  • Using inherited sample time (-1) incorrectly
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard