Bird
Raised Fist0
Simulinkdata~10 mins

Source blocks (Constant, Step, Sine Wave, Ramp) in Simulink - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Source blocks (Constant, Step, Sine Wave, Ramp)
Start Simulation
↓
Select Source Block
↓
Constant
↓
Step
↓
Sine Wave
↓
Ramp
↓
Output Signal Data
↓
End Simulation
The simulation starts by selecting one of the source blocks (Constant, Step, Sine Wave, Ramp). Each block generates its specific signal type, which is then output as simulation data.
Execution Sample
Simulink
time = 0:0.1:1;
constant = 5;
step = time >= 0.5;
sine_wave = sin(2*pi*1*time);
ramp = time;
This code simulates the four source blocks generating their signals over time from 0 to 1 second.
Execution Table
SteptimeConstant OutputStep OutputSine Wave OutputRamp Output
10.0500.00.0
20.1500.590.1
30.2500.950.2
40.3500.950.3
50.4500.590.4
60.5510.00.5
70.651-0.590.6
80.751-0.950.7
90.851-0.950.8
100.951-0.590.9
111.0510.01.0
💡 Simulation ends after time reaches 1.0 seconds.
Variable Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6After 7After 8After 9After 10Final
time0.00.00.10.20.30.40.50.60.70.80.91.0
Constant Output555555555555
Step Output000000111111
Sine Wave Output0.00.00.590.950.950.590.0-0.59-0.95-0.95-0.590.0
Ramp Output0.00.00.10.20.30.40.50.60.70.80.91.0
Key Moments - 3 Insights
Why does the Step Output change from 0 to 1 at time 0.5?
Because the Step block output is 0 before the step time (0.5) and changes to 1 at and after 0.5, as shown in execution_table row 6.
Why is the Constant Output always 5 regardless of time?
The Constant block outputs the same fixed value (5) at every time step, as seen in the execution_table where Constant Output stays 5 throughout.
Why does the Sine Wave Output oscillate between positive and negative values?
The Sine Wave block generates a sine function over time, which naturally oscillates, shown in execution_table rows 2 to 11 with values going up and down.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the Step Output at time 0.4?
A0.5
B1
C0
DUndefined
💡 Hint
Check the Step Output column at Step 5 (time 0.4) in the execution_table.
At which time step does the Ramp Output reach 0.7?
AStep 8
BStep 7
CStep 6
DStep 9
💡 Hint
Look at the Ramp Output column in the execution_table and find when it equals 0.7.
If the Constant block value changed to 10, what would be the Constant Output at time 0.3?
A5
B10
C0.3
DUndefined
💡 Hint
Constant Output is always the fixed value set, see variable_tracker for Constant Output values.
Concept Snapshot
Source blocks generate signals over time:
- Constant: fixed value always
- Step: jumps from 0 to 1 at step time
- Sine Wave: oscillates sinusoidally
- Ramp: increases linearly with time
Use these blocks to simulate input signals in Simulink.
Full Transcript
This visual execution shows how Simulink source blocks produce signals over time. The Constant block outputs a fixed value at every time step. The Step block outputs zero before the step time and one after. The Sine Wave block outputs values following a sine function, oscillating between positive and negative. The Ramp block outputs values increasing linearly with time. The execution table traces these outputs at each time step from 0 to 1 second. Variable tracking shows how each signal changes step-by-step. Key moments clarify common confusions about when outputs change and why. The quiz tests understanding by referencing the execution table and variable states.

Practice

(1/5)
1. Which Simulink source block provides a fixed value throughout the simulation?
easy
A. Ramp block
B. Step block
C. Sine Wave block
D. Constant block

Solution

  1. Step 1: Understand the behavior of each source block

    The Constant block outputs a fixed value that does not change over time. The Step block changes value at a specified time. The Sine Wave block outputs a sinusoidal signal. The Ramp block outputs a linearly increasing or decreasing signal.
  2. Step 2: Identify the block with fixed output

    Only the Constant block maintains the same value throughout the simulation without change.
  3. Final Answer:

    Constant block -> Option D
  4. Quick Check:

    Fixed value = Constant block [OK]
Hint: Constant means no change over time [OK]
Common Mistakes:
  • Confusing Step block with Constant because both output numbers
  • Thinking Sine Wave can be constant
  • Assuming Ramp outputs fixed value
2. Which of the following is the correct way to set a Step block to change value at time 5 seconds?
easy
A. Set Final value to 0 and Step time to 5
B. Set Step time to 0 and Initial value to 5
C. Set Step time to 5 and Final value to new value
D. Set Initial value to 5 and Step time to 10

Solution

  1. Step 1: Recall Step block parameters

    The Step block changes its output from Initial value to Final value at the specified Step time.
  2. Step 2: Identify correct parameter settings for change at 5 seconds

    To change at 5 seconds, Step time must be 5. Final value is the new output after 5 seconds.
  3. Final Answer:

    Set Step time to 5 and Final value to new value -> Option C
  4. Quick Check:

    Step time = 5 for change at 5 seconds [OK]
Hint: Step time sets when value changes [OK]
Common Mistakes:
  • Setting Step time to 0 causes immediate change
  • Confusing Initial and Final values
  • Setting wrong Step time for desired change
3. What output values will a Ramp block produce at times t = 0, 2, and 4 seconds if its slope is set to 3 and initial output is 1?
medium
A. [1, 4, 7]
B. [1, 7, 13]
C. [0, 6, 12]
D. [1, 3, 5]

Solution

  1. Step 1: Understand Ramp block output formula

    Output = Initial output + slope * time. Here, initial output = 1, slope = 3.
  2. Step 2: Calculate output at each time

    At t=0: 1 + 3*0 = 1; t=2: 1 + 3*2 = 7; t=4: 1 + 3*4 = 13.
  3. Step 3: Match calculated values with options

    The calculated outputs [1, 7, 13] match [1, 7, 13].
  4. Final Answer:

    [1, 7, 13] -> Option B
  5. Quick Check:

    Output = 1 + 3*t matches [1,7,13] [OK]
Hint: Ramp output = initial + slope x time [OK]
Common Mistakes:
  • Forgetting to add initial output
  • Multiplying slope by wrong time values
  • Mixing up options with similar numbers
4. A user sets a Step block with Initial value = 0, Final value = 10, but the output never changes during simulation. What is the likely error?
medium
A. Step time is set after simulation end time
B. Initial value equals Final value
C. Step time is set to 0
D. Final value is less than Initial value

Solution

  1. Step 1: Understand Step block timing

    The Step block changes output at Step time. If Step time is after simulation ends, change never happens during simulation.
  2. Step 2: Analyze given values

    Initial value = 0, Final value = 10, so values differ. If output never changes, likely Step time is beyond simulation time.
  3. Final Answer:

    Step time is set after simulation end time -> Option A
  4. Quick Check:

    Step time > simulation time means no output change [OK]
Hint: Step time must be within simulation time [OK]
Common Mistakes:
  • Assuming Initial equals Final value causes no change
  • Ignoring simulation stop time
  • Confusing Step time with Final value
5. You want to simulate a signal that starts at 2, stays constant until 3 seconds, then increases smoothly by 4 units every second. Which combination of source blocks should you use?
hard
A. Step block from 2 to 2 at 3 seconds and Ramp block starting at 3 seconds with slope 4
B. Step block changing from 2 to 6 at 3 seconds
C. Sine Wave block with amplitude 2 and frequency 4
D. Constant block with value 2 and Ramp block starting at 3 seconds with slope 4

Solution

  1. Step 1: Analyze signal requirements

    Signal starts at 2, constant until 3 seconds, then increases smoothly by 4 units per second.
  2. Step 2: Choose blocks to model behavior

    Use Step block to hold value at 2 until 3 seconds (change from 2 to 2 at 3 seconds means no jump). Then use Ramp block starting at 3 seconds with slope 4 to increase smoothly.
  3. Step 3: Confirm other options

    Constant block with value 2 and Ramp block starting at 3 seconds with slope 4 is incorrect because Ramp cannot start at 3 seconds alone without Step block. Step block changing from 2 to 6 at 3 seconds is wrong because Step block changes instantly, not smoothly. Sine Wave block with amplitude 2 and frequency 4 is unrelated sine wave.
  4. Final Answer:

    Step block from 2 to 2 at 3 seconds and Ramp block starting at 3 seconds with slope 4 -> Option A
  5. Quick Check:

    Step holds constant, Ramp adds smooth increase [OK]
Hint: Combine Step for hold and Ramp for smooth increase [OK]
Common Mistakes:
  • Using only Step block causes sudden jump
  • Using Constant block alone can't model increase
  • Confusing Sine Wave with linear increase
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