---
url: /dyad/dev/stdlib/BlockComponents/components/Math.LinearDependency.md
description: >-
  Dyad Math.LinearDependency docs.  Outputs a linear combination of two input
  signals.
---

# `Math.LinearDependency` {#Math.LinearDependency}

Outputs a linear combination of two input signals.

Computes the output `y` as a linear combination of the two inputs `u1` and `u2` with an offset:

$$y = y_0 + k_1 \cdot u_1 + k_2 \cdot u_2$$

This component extends from [`BlockComponents.Interfaces.SI2SO`](../types/Interfaces.SI2SO.md)

## Usage {#Usage}

`BlockComponents.Math.LinearDependency(y0=0.0, k1=0.0, k2=0.0)`

## Parameters: {#Parameters:}

| Name |             Description | Units | Default value |
| ----:| -----------------------:| -----:| -------------:|
| `y0` |            Offset value |     – |           0.0 |
| `k1` |  Gain of first input u1 |     – |           0.0 |
| `k2` | Gain of second input u2 |     – |           0.0 |

## Connectors {#Connectors}

* `u1` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `u2` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

$$ \begin{align}
y\left( t \right) &= \mathtt{y0} + \mathtt{k1} ~ \mathtt{u1}\left( t \right) + \mathtt{k2} ~ \mathtt{u2}\left( t \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
Outputs a linear combination of two input signals.

Computes the output `y` as a linear combination of the two inputs `u1` and
`u2` with an offset:

```math
y = y_0 + k_1 \\cdot u_1 + k_2 \\cdot u_2
```
"""
component LinearDependency
  extends BlockComponents.Interfaces.SI2SO
  "Offset value"
  parameter y0::Real = 0.0
  "Gain of first input u1"
  parameter k1::Real = 0.0
  "Gain of second input u2"
  parameter k2::Real = 0.0
relations
  "Computes the linear combination of the two inputs"
  y = y0 + k1 * u1 + k2 * u2
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/LinearDependency.svg"}
  }
}
end
````

````dyad
"""
Outputs a linear combination of two input signals.

Computes the output `y` as a linear combination of the two inputs `u1` and
`u2` with an offset:

```math
y = y_0 + k_1 \\cdot u_1 + k_2 \\cdot u_2
```
"""
component LinearDependency
  "First real-valued input signal"
  u1 = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -100, "y1": 150, "x2": 0, "y2": 250, "rot": 0},
        "diagram": {"iconName": "default", "x1": -100, "y1": 150, "x2": 0, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  "Second real-valued input signal"
  u2 = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -100, "y1": 750, "x2": 0, "y2": 850, "rot": 0},
        "diagram": {"iconName": "default", "x1": -100, "y1": 750, "x2": 0, "y2": 850, "rot": 0}
      }
    }
  }
  "Real-valued output signal"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  "Offset value"
  parameter y0::Real = 0.0
  "Gain of first input u1"
  parameter k1::Real = 0.0
  "Gain of second input u2"
  parameter k2::Real = 0.0
relations
  "Computes the linear combination of the two inputs"
  y = y0 + k1 * u1 + k2 * u2
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/LinearDependency.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Constant`](Math.LinearDependency.md)

  * [`LinearDependency`](Math.LinearDependency.md)

  * [`LinearDependency`](Math.LinearDependency.md)

  * [`Sine`](Math.LinearDependency.md)
