French
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.pulse.library.sawtooth

sawtooth(duration, amp, freq=None, phase=0, name=None)[source]

Generates sawtooth wave Waveform.

For \(A=\) amp, \(T=\) period, and \(\phi=\) phase, applies the midpoint sampling strategy to generate a discrete pulse sampled from the continuous function:

\[f(x) = 2 A \left( g(x) - \left\lfloor \frac{1}{2} + g(x) \right\rfloor\right)\]

where \(g(x) = x/T + \phi/\pi\).

Paramètres
  • duration (int) – Duration of pulse. Must be greater than zero.

  • amp (complex) – Pulse amplitude. Wave range is \([-\) amp \(,\) amp \(]\).

  • freq (Optional[float]) – Pulse frequency, units of 1./dt. If None defaults to 1./duration.

  • phase (float) – Pulse phase.

  • name (Optional[str]) – Name of pulse.

Type renvoyé

Waveform

Exemple

import matplotlib.pyplot as plt
from qiskit.pulse.library import sawtooth
import numpy as np

duration = 100
amp = 1
freq = 1 / duration
sawtooth_wave = np.real(sawtooth(duration, amp, freq).samples)
plt.plot(range(duration), sawtooth_wave)
plt.show()

(Source code)

../_images/qiskit-pulse-library-sawtooth-1.png