BlockWerk Documentation
K

Gain

Math

The Gain block multiplies its input signal by a constant gain factor (K). This is one of the most fundamental and commonly used blocks in signal processing and control systems. It provides simple scaling of signals without changing their fundamental characteristics.

The block has one input port and one output port, making it straightforward to integrate into signal chains. Common applications include proportional gain in controllers, signal amplification, and unit conversion.

Simulate in BlockWerk

Interactive sandbox directly in your browser — zero installation, WASM-powered.

Simulate in BlockWerk →

Mathematical Model

The Gain block implements a simple multiplication operation:

y(t)=K⋅u(t)y(t) = K \cdot u(t)

Where:

  • output(t) is the output signal at time t
  • K is the gain factor (configurable parameter)
  • input(t) is the input signal at time t

Inputs & Outputs

Direction ID Label Type Status
→ In in Input number Required
← Out out Output number Output

Parameters

Parameters Label Type Default Description
gain Gain (K) number 1 Multiplication factor for the input signal

Usage Examples

Signal Inversion

Invert a sine wave signal:

SignalGenerator → Gain (gain: -1) → Scope

Signal Amplification

Double the output of a sensor:

Sensor → Gain (gain: 2) → NumericDisplay

Remarks & Best Practices

  • No Internal State: Pure function with no memory - output depends only on current input.
  • Linear Operation: Does not introduce distortion or harmonics.
  • Computation Cost: Minimal - single multiplication operation per simulation step.
  • WASM Powered: Near-native execution speed in the browser.

Related Components

  • Sum: Add multiple signals together
  • Constant: Provide fixed values for gain scaling
  • NumericDisplay: View the result in real-time