SignalMath.GenerateSawtooth Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0

Overload List

GenerateSawtooth(Double, Double, Double, Span<Double>) Generates a sawtooth wave signal.
GenerateSawtooth(Int32, Double, Double, Double) Generates a sawtooth wave signal and returns it as a vector.
GenerateSawtooth(Vector<Double>, Double, Double, Double) Generates a sawtooth wave signal at explicit x values and returns it as a vector.
GenerateSawtooth(Double, Double, Double, Double, Span<Double>) Generates a sawtooth wave signal with DC offset.
GenerateSawtooth(Int32, Double, Double, Double, Double) Generates a sawtooth wave signal with DC offset and returns it as a vector.
GenerateSawtooth(ReadOnlySpan<Double>, Double, Double, Double, Span<Double>) Generates a sawtooth wave signal at explicit x values.
GenerateSawtooth(Vector<Double>, Double, Double, Double, Double) Generates a sawtooth wave signal with DC offset at explicit x values and returns it as a vector.
GenerateSawtooth(ReadOnlySpan<Double>, Double, Double, Double, Double, Span<Double>) Generates a sawtooth wave signal with DC offset at explicit x values.

GenerateSawtooth(Double, Double, Double, Span<Double>)

Generates a sawtooth wave signal.
C#
public static void GenerateSawtooth(
	double amplitude,
	double angularFrequency,
	double phase,
	Span<double> destination
)

Parameters

amplitude  Double
The amplitude of the sawtooth wave.
angularFrequency  Double
The angular frequency in radians per sample.
phase  Double
The initial phase in radians.
destination  Span<Double>
The destination span to write the generated signal.

Remarks

Generates a sawtooth wave according to the formula:

y[n] = A(2r - 1), where r = frac((ωn + φ)/(2π))

The sawtooth wave has a linear ramp from -A to A over one period.

GenerateSawtooth(Int32, Double, Double, Double)

Generates a sawtooth wave signal and returns it as a vector.
C#
public static Vector<double> GenerateSawtooth(
	int count,
	double amplitude,
	double angularFrequency,
	double phase
)

Parameters

count  Int32
The number of samples to generate.
amplitude  Double
The amplitude of the sawtooth wave.
angularFrequency  Double
The angular frequency in radians per sample.
phase  Double
The initial phase in radians.

Return Value

Vector<Double>
A vector containing the generated sawtooth wave signal.

GenerateSawtooth(Vector<Double>, Double, Double, Double)

Generates a sawtooth wave signal at explicit x values and returns it as a vector.
C#
public static Vector<double> GenerateSawtooth(
	Vector<double> x,
	double amplitude,
	double angularFrequency,
	double phase
)

Parameters

x  Vector<Double>
The x values at which to evaluate the sawtooth wave.
amplitude  Double
The amplitude of the sawtooth wave.
angularFrequency  Double
The angular frequency in radians per x-unit.
phase  Double
The initial phase in radians.

Return Value

Vector<Double>
A vector containing the generated sawtooth wave signal.

GenerateSawtooth(Double, Double, Double, Double, Span<Double>)

Generates a sawtooth wave signal with DC offset.
C#
public static void GenerateSawtooth(
	double amplitude,
	double angularFrequency,
	double phase,
	double offset,
	Span<double> destination
)

Parameters

amplitude  Double
The amplitude of the sawtooth wave.
angularFrequency  Double
The angular frequency in radians per sample.
phase  Double
The initial phase in radians.
offset  Double
The DC offset to add to the signal.
destination  Span<Double>
The destination span to write the generated signal.

GenerateSawtooth(Int32, Double, Double, Double, Double)

Generates a sawtooth wave signal with DC offset and returns it as a vector.
C#
public static Vector<double> GenerateSawtooth(
	int count,
	double amplitude,
	double angularFrequency,
	double phase,
	double offset
)

Parameters

count  Int32
The number of samples to generate.
amplitude  Double
The amplitude of the sawtooth wave.
angularFrequency  Double
The angular frequency in radians per sample.
phase  Double
The initial phase in radians.
offset  Double
The DC offset to add to the signal.

Return Value

Vector<Double>
A vector containing the generated sawtooth wave signal.

GenerateSawtooth(ReadOnlySpan<Double>, Double, Double, Double, Span<Double>)

Generates a sawtooth wave signal at explicit x values.
C#
public static void GenerateSawtooth(
	ReadOnlySpan<double> x,
	double amplitude,
	double angularFrequency,
	double phase,
	Span<double> destination
)

Parameters

x  ReadOnlySpan<Double>
The x values at which to evaluate the sawtooth wave.
amplitude  Double
The amplitude of the sawtooth wave.
angularFrequency  Double
The angular frequency in radians per x-unit.
phase  Double
The initial phase in radians.
destination  Span<Double>
The destination span to write the generated signal.

GenerateSawtooth(Vector<Double>, Double, Double, Double, Double)

Generates a sawtooth wave signal with DC offset at explicit x values and returns it as a vector.
C#
public static Vector<double> GenerateSawtooth(
	Vector<double> x,
	double amplitude,
	double angularFrequency,
	double phase,
	double offset
)

Parameters

x  Vector<Double>
The x values at which to evaluate the signal.
amplitude  Double
The amplitude of the signal.
angularFrequency  Double
The angular frequency in radians per sample.
phase  Double
The initial phase in radians.
offset  Double
The DC offset to add to the signal.

Return Value

Vector<Double>
A vector containing the generated signal.

GenerateSawtooth(ReadOnlySpan<Double>, Double, Double, Double, Double, Span<Double>)

Generates a sawtooth wave signal with DC offset at explicit x values.
C#
public static void GenerateSawtooth(
	ReadOnlySpan<double> x,
	double amplitude,
	double angularFrequency,
	double phase,
	double offset,
	Span<double> destination
)

Parameters

x  ReadOnlySpan<Double>
The x values at which to evaluate the sawtooth wave.
amplitude  Double
The amplitude of the sawtooth wave.
angularFrequency  Double
The angular frequency in radians per x-unit.
phase  Double
The initial phase in radians.
offset  Double
The DC offset to add to the signal.
destination  Span<Double>
The destination span to write the generated signal.

See Also