---
url: /dyad/stable/stdlib/MultibodyComponents/components/Concat3.md
description: >-
  Dyad Concat3 docs.  Three-way array concatenation. Takes three array inputs of
  structural sizes n1, n2, n3 and produces a single output array of size n1 + n2
  + ...
---

# `Concat3` {#Concat3}

Three-way array concatenation. Takes three array inputs of structural sizes `n1`, `n2`, `n3` and produces a single output array of size `n1 + n2 + n3` whose elements are `[u1; u2; u3]` in order. Used in `LQRControlledRotorCraft` to assemble the 13-element measurement vector.

## Usage {#Usage}

`MultibodyComponents.Concat3()`

## Parameters: {#Parameters:}

|   Name |                                                                                        Description | Units | Default value |
| ------:| --------------------------------------------------------------------------------------------------:| -----:| -------------:|
|   `n1` |                                                                    Length of the first input array |     – |             1 |
|   `n2` |                                                                   Length of the second input array |     – |             1 |
|   `n3` |                                                                    Length of the third input array |     – |             1 |
| `nsum` | Total output length (= n1 + n2 + n3); named because Dyad array sizes can't be compound expressions |     – |  n1 + n2 + n3 |

## 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))

* `u3` - 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\_{1}\left( t \right) &= \mathtt{u1}\_{1}\left( t \right) \\
y\_{2}\left( t \right) &= \mathtt{u2}\_{1}\left( t \right) \\
y\_{3}\left( t \right) &= \mathtt{u3}\_{1}\left( t \right)
\end{align}
$$

## Source {#Source}

```dyad
"""
Three-way array concatenation. Takes three array inputs of structural sizes
`n1`, `n2`, `n3` and produces a single output array of size `n1 + n2 + n3`
whose elements are `[u1; u2; u3]` in order. Used in `LQRControlledRotorCraft`
to assemble the 13-element measurement vector.
"""
component Concat3
  "First input array (occupies indices 1..n1 of `y`)"
  u1 = [RealInput() for i in 1:n1] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 170, "x2": 0, "y2": 270, "rot": 0}
      },
      "tags": []
    }
  }
  "Second input array (occupies indices n1+1..n1+n2 of `y`)"
  u2 = [RealInput() for i in 1:n2] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Third input array (occupies indices n1+n2+1..n1+n2+n3 of `y`)"
  u3 = [RealInput() for i in 1:n3] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 730, "x2": 0, "y2": 830, "rot": 0}
      },
      "tags": []
    }
  }
  "Concatenated output array of length nsum"
  y = [RealOutput() for i in 1:nsum] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Length of the first input array"
  structural parameter n1::Integer = 1
  "Length of the second input array"
  structural parameter n2::Integer = 1
  "Length of the third input array"
  structural parameter n3::Integer = 1
  "Total output length (= n1 + n2 + n3); named because Dyad array sizes can't be compound expressions"
  final structural parameter nsum::Integer = n1 + n2 + n3
relations
  for i in 1:n1
    y[i] = u1[i]
  end
  for i in 1:n2
    y[n1 + i] = u2[i]
  end
  for i in 1:n3
    y[n1 + n2 + i] = u3[i]
  end
end
```

```dyad
"""
Three-way array concatenation. Takes three array inputs of structural sizes
`n1`, `n2`, `n3` and produces a single output array of size `n1 + n2 + n3`
whose elements are `[u1; u2; u3]` in order. Used in `LQRControlledRotorCraft`
to assemble the 13-element measurement vector.
"""
component Concat3
  "First input array (occupies indices 1..n1 of `y`)"
  u1 = [RealInput() for i in 1:n1] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 170, "x2": 0, "y2": 270, "rot": 0}
      },
      "tags": []
    }
  }
  "Second input array (occupies indices n1+1..n1+n2 of `y`)"
  u2 = [RealInput() for i in 1:n2] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Third input array (occupies indices n1+n2+1..n1+n2+n3 of `y`)"
  u3 = [RealInput() for i in 1:n3] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 730, "x2": 0, "y2": 830, "rot": 0}
      },
      "tags": []
    }
  }
  "Concatenated output array of length nsum"
  y = [RealOutput() for i in 1:nsum] {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "Length of the first input array"
  structural parameter n1::Integer = 1
  "Length of the second input array"
  structural parameter n2::Integer = 1
  "Length of the third input array"
  structural parameter n3::Integer = 1
  "Total output length (= n1 + n2 + n3); named because Dyad array sizes can't be compound expressions"
  final structural parameter nsum::Integer = n1 + n2 + n3
relations
  for i in 1:n1
    y[i] = u1[i]
  end
  for i in 1:n2
    y[n1 + i] = u2[i]
  end
  for i in 1:n3
    y[n1 + n2 + i] = u3[i]
  end
metadata {}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
