0
0
SimulinkHow-ToBeginner · 3 min read

How to Use Gain Block in Simulink: Simple Guide

In Simulink, use the Gain block to multiply an input signal by a constant value. Drag the Gain block from the Simulink library, set the gain value in its parameters, and connect it to your signal line to apply the multiplication.
📐

Syntax

The Gain block multiplies the input signal by a specified gain value.

Key parts:

  • Gain: The block itself that performs multiplication.
  • Gain value: The constant number you set to multiply the input signal.
  • Input signal: The signal entering the block.
  • Output signal: The result after multiplication.
none
Gain block: output = input * Gain_value
💻

Example

This example shows how to multiply a sine wave signal by 5 using the Gain block.

none
1. Open Simulink and create a new model.
2. Drag a <code>Sine Wave</code> block from the Sources library.
3. Drag a <code>Gain</code> block from the Math Operations library.
4. Double-click the Gain block and set <code>Gain</code> to 5.
5. Drag a <code>Scope</code> block from the Sinks library.
6. Connect the Sine Wave output to the Gain input.
7. Connect the Gain output to the Scope input.
8. Run the simulation and open the Scope to see the amplified sine wave.
Output
The Scope shows a sine wave with amplitude multiplied by 5 compared to the original sine wave.
⚠️

Common Pitfalls

Common mistakes when using the Gain block:

  • Not setting the gain value correctly (e.g., leaving it empty or zero).
  • Connecting incompatible signal types (e.g., complex signals without proper handling).
  • Forgetting to connect the output to a sink like Scope, so you see no result.
  • Using a gain value as a string instead of a numeric value.

Wrong: Setting gain as '5' (string)
Right: Setting gain as 5 (number)

matlab
Gain = '5';  % Wrong: string value
Gain = 5;    % Correct: numeric value
📊

Quick Reference

ParameterDescription
GainConstant multiplier for the input signal
InputSignal entering the Gain block
OutputSignal after multiplication
Data typeEnsure numeric type for gain value
ScopeUse to visualize output signal

Key Takeaways

Use the Gain block to multiply signals by a constant value in Simulink.
Set the gain parameter as a numeric value, not a string.
Connect the Gain block input and output properly to see results.
Use Scope blocks to visualize the output signal after gain.
Check signal compatibility to avoid errors with the Gain block.