---
url: /dyad/stable/stdlib/BlockComponents/tests/Sources.Tests.LogFrequencySweep.md
description: >-
  Dyad Sources.Tests.LogFrequencySweep docs.  Test that validates logarithmic
  frequency sweep behavior.
---

# `Sources.Tests.LogFrequencySweep` {#Sources.Tests.LogFrequencySweep}

Test that validates logarithmic frequency sweep behavior.

This component creates a test setup for validating the `LogFrequencySweep` block by connecting its output to a `Terminator`. The sweep starts at `wMin=1` and ends at `wMax=100` over a `duration` of 3 seconds. The output ramps logarithmically from 1 to 100, meaning the logarithm of the output performs a linear ramp from `log10(1)=0` to `log10(100)=2`.

## Usage {#Usage}

`BlockComponents.Sources.Tests.LogFrequencySweep()`

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathrm{connect}\left( signal\_{+}y, terminator\_{+}u \right) \\
\mathtt{signal.y}\left( t \right) &= ifelse\left( t < \mathtt{signal.startTime}, \mathtt{signal.wMin}, ifelse\left( t < max\left( \mathtt{signal.duration}, \mathtt{signal.eps0} \right) + \mathtt{signal.startTime}, \left( \frac{\mathtt{signal.wMax}}{\mathtt{signal.wMin}} \right)^{min\left( 1, \frac{ - \mathtt{signal.startTime} + t}{max\left( \mathtt{signal.duration}, \mathtt{signal.eps0} \right)} \right)} ~ \mathtt{signal.wMin}, \mathtt{signal.wMax} \right) \right)
\end{align}
$$

## Source {#Source}

```dyad
"""
Test that validates logarithmic frequency sweep behavior.

This component creates a test setup for validating the `LogFrequencySweep` block by
connecting its output to a `Terminator`. The sweep starts at `wMin=1` and ends at
`wMax=100` over a `duration` of 3 seconds. The output ramps logarithmically from 1
to 100, meaning the logarithm of the output performs a linear ramp from `log10(1)=0`
to `log10(100)=2`.
"""
test component LogFrequencySweep
  "Terminates a signal connection without passing it further"
  terminator = BlockComponents.Routing.Terminator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 155, "y1": 20, "x2": 255, "y2": 120, "rot": 0}
      }
    }
  }
  "Generates a logarithmic frequency sweep from wMin to wMax"
  signal = BlockComponents.Sources.LogFrequencySweep(wMin = 1, wMax = 100, startTime = 0, duration = 3) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      }
    }
  }
relations
  "Connects the sweep output to the terminator input"
  connect(signal.y, terminator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {"case1": {"stop": 4, "expect": {"signals": ["signal.y", "terminator.u"]}}}
  }
}
end
```

```dyad
"""
Test that validates logarithmic frequency sweep behavior.

This component creates a test setup for validating the `LogFrequencySweep` block by
connecting its output to a `Terminator`. The sweep starts at `wMin=1` and ends at
`wMax=100` over a `duration` of 3 seconds. The output ramps logarithmically from 1
to 100, meaning the logarithm of the output performs a linear ramp from `log10(1)=0`
to `log10(100)=2`.
"""
test component LogFrequencySweep
  "Terminates a signal connection without passing it further"
  terminator = BlockComponents.Routing.Terminator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 155, "y1": 20, "x2": 255, "y2": 120, "rot": 0}
      }
    }
  }
  "Generates a logarithmic frequency sweep from wMin to wMax"
  signal = BlockComponents.Sources.LogFrequencySweep(wMin = 1, wMax = 100, startTime = 0, duration = 3) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
      }
    }
  }
relations
  "Connects the sweep output to the terminator input"
  connect(signal.y, terminator.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {"case1": {"stop": 4, "expect": {"signals": ["signal.y", "terminator.u"]}}}
  }
}
end
```

## Test Cases {#Test-Cases}

### Test Case `case1` {#Test-Case-case1}

```julia
plt
```

![](xzssyyy.svg)

```julia
plt
```

![](gyizgqi.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`LogFrequencySweep`](Sources.Tests.LogFrequencySweep.md)

  * [`LogFrequencySweep`](Sources.Tests.LogFrequencySweep.md)

  * [`Terminator`](Sources.Tests.LogFrequencySweep.md)
