Skip to content
LIBRARY
Sources.Chirp.md

Sources.Chirp

The Chirp block generates a time-varying frequency sweep signal (chirp).

A chirp is a sinusoidal signal whose frequency increases over time. This block supports three chirp laws:

1. Linear chirp Frequency increases linearly from fmin to fmax over duration T. Phase law: φ(t) = fmin·t + (fmax − fmin)/(2·T) · t²

2. Quadratic chirp Frequency increases quadratically over time, producing a slower start and faster rise. Phase law: φ(t) = fmin·t + (fmax − fmin)/(3·T²) · t³

3. Exponential chirp Frequency increases exponentially, spending equal time per octave. Phase law: φ(t) = fmin·T / ln(fmax/fmin) · ((fmax/fmin)^(t/T) − 1)

The output is always: y(t) = amplitude · sin(2π·φ(t) + phase)

This component extends from BlockComponents.Interfaces.SO

Usage

BlockComponents.Sources.Chirp(fmin=0.1, fmax=5, T=100, amplitude=1, phase=0)

Parameters:

NameDescriptionUnitsDefault value
lawChoice of chirp lawChirpLaw.Quadratic()
fminInitial frequencyHz0.1
fmaxFrequency at durationHz5
TSignal durations100
amplitudeAmplitude1
phasePhase0

Connectors

  • y - This connector represents a real signal as an output from a component (RealOutput)

Variables

NameDescriptionUnits
phi

Behavior

y(t)=amplitude sin(phase+6.2832 phi(t))phi(t)=t3 (fmaxfmin)3 T2+fmin t

Source

dyad
"""
The `Chirp` block generates a time-varying frequency sweep signal (chirp).

A chirp is a sinusoidal signal whose frequency increases over time.
This block supports three chirp laws:

**1. Linear chirp**
Frequency increases linearly from `fmin` to `fmax` over duration `T`.
Phase law:
φ(t) = fmin·t + (fmax − fmin)/(2·T) · t²

**2. Quadratic chirp**
Frequency increases quadratically over time, producing a slower start and faster rise.
Phase law:
φ(t) = fmin·t + (fmax − fmin)/(3·T²) · t³

**3. Exponential chirp**
Frequency increases exponentially, spending equal time per octave.
Phase law:
φ(t) = fmin·T / ln(fmax/fmin) · ((fmax/fmin)^(t/T) − 1)

The output is always:
y(t) = amplitude · sin(2π·φ(t) + phase)
"""
component Chirp
  extends BlockComponents.Interfaces.SO
  "Initial frequency"
  parameter fmin::Frequency = 0.1
  "Frequency at duration"
  parameter fmax::Frequency = 5
  "Signal duration"
  parameter T::Time = 100
  "Amplitude"
  parameter amplitude::Real = 1
  "Phase"
  parameter phase::Real = 0
  "Choice of chirp law"
  structural parameter law::ChirpLaw = ChirpLaw.Quadratic()
  variable phi::Real
relations
  y = amplitude * sin(2 * pi * phi + phase)
  switch law
    case Linear
      phi = fmin * time + (fmax - fmin) / (2 * T) * time ^ 2
    case Quadratic
      phi = fmin * time + (fmax - fmin) / (3 * T ^ 2) * time ^ 3
    case Exponential
      phi = fmin * T / log(fmax / fmin) * ((fmax / fmin) ^ (time / T) - 1)
  end
metadata {
  "Dyad": {
    "experiments": {},
    "tests": {},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "icons": {"default": "dyad://BlockComponents/Chirp.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end
Flattened Source
dyad
"""
The `Chirp` block generates a time-varying frequency sweep signal (chirp).

A chirp is a sinusoidal signal whose frequency increases over time.
This block supports three chirp laws:

**1. Linear chirp**
Frequency increases linearly from `fmin` to `fmax` over duration `T`.
Phase law:
φ(t) = fmin·t + (fmax − fmin)/(2·T) · t²

**2. Quadratic chirp**
Frequency increases quadratically over time, producing a slower start and faster rise.
Phase law:
φ(t) = fmin·t + (fmax − fmin)/(3·T²) · t³

**3. Exponential chirp**
Frequency increases exponentially, spending equal time per octave.
Phase law:
φ(t) = fmin·T / ln(fmax/fmin) · ((fmax/fmin)^(t/T) − 1)

The output is always:
y(t) = amplitude · sin(2π·φ(t) + phase)
"""
component Chirp
  "Real-valued output connector for the component"
  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}
      }
    }
  }
  "Initial frequency"
  parameter fmin::Frequency = 0.1
  "Frequency at duration"
  parameter fmax::Frequency = 5
  "Signal duration"
  parameter T::Time = 100
  "Amplitude"
  parameter amplitude::Real = 1
  "Phase"
  parameter phase::Real = 0
  "Choice of chirp law"
  structural parameter law::ChirpLaw = ChirpLaw.Quadratic()
  variable phi::Real
relations
  y = amplitude * sin(2 * pi * phi + phase)
  switch law
    case Linear
      phi = fmin * time + (fmax - fmin) / (2 * T) * time ^ 2
    case Quadratic
      phi = fmin * time + (fmax - fmin) / (3 * T ^ 2) * time ^ 3
    case Exponential
      phi = fmin * T / log(fmax / fmin) * ((fmax / fmin) ^ (time / T) - 1)
  end
metadata {
  "Dyad": {
    "experiments": {},
    "tests": {},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "icons": {"default": "dyad://BlockComponents/Chirp.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end


Test Cases

No test cases defined.