Code Packages  1
Add-on code processing modules
Static Public Member Functions | List of all members
dsp.Generator Class Reference

Provides basic functions to form discrete wave shapes More...

Static Public Member Functions

static double [] GaussNoise (int samples, Random rand)
 Returns a random (noise) array that has a Gaussian distribution More...
 
static double [] PN (int samples, Random rand)
 Pseudorandom number generator More...
 
static double [] Row (double start, double step, double end)
 Returns a row array by specifing limits and a step value More...
 
static double [] Sawtooth (double f, double amplitude, double fs, int components, int samples)
 Returns a sawtooth wave More...
 
static double [] Sine (double f, double amplitude, double phase, double offset, double fs, int samples)
 Returns a sine wave (overloaded) More...
 
static double [] Sine (double f, double amplitude, double fs, int samples)
 Returns a sine wave More...
 
static double [] Square (double f, double amplitude, double fs, int components, int samples)
 Returns a square wave More...
 
static double [] Triangle (double f, double amplitude, double fs, int components, int samples)
 Returns a triangle wave More...
 

Detailed Description

Provides basic functions to form discrete wave shapes

Member Function Documentation

◆ GaussNoise()

static double [] dsp.Generator.GaussNoise ( int  samples,
Random  rand 
)
static

Returns a random (noise) array that has a Gaussian distribution

Parameters
samplessize of the wave
randrandom object

◆ PN()

static double [] dsp.Generator.PN ( int  samples,
Random  rand 
)
static

Pseudorandom number generator

Parameters
samplessize of the wave
randrandom object

◆ Row()

static double [] dsp.Generator.Row ( double  start,
double  step,
double  end 
)
static

Returns a row array by specifing limits and a step value

Parameters
startstart index value
stepstep value, can be incremental(+) or decremental(-)
endend index value

Example

double[] A = Generator.Row(0.5, 1.5, 4);
Console.WriteLine(NArray.ToString(A));
0.5 2 3.5

◆ Sawtooth()

static double [] dsp.Generator.Sawtooth ( double  f,
double  amplitude,
double  fs,
int  components,
int  samples 
)
static

Returns a sawtooth wave

Parameters
ffoundamental frequency (Hz)
amplitudeamplitude
fssampling rate (Hz)
componentsnumber of harmonic components
samplessize of the wave

◆ Sine() [1/2]

static double [] dsp.Generator.Sine ( double  f,
double  amplitude,
double  phase,
double  offset,
double  fs,
int  samples 
)
static

Returns a sine wave (overloaded)

Parameters
ffoundamental frequency (Hz)
amplitudeamplitude
phaseinitial phase in radians
offsetvertical offset
fssampling rate (Hz)
samplessize of the wave

◆ Sine() [2/2]

static double [] dsp.Generator.Sine ( double  f,
double  amplitude,
double  fs,
int  samples 
)
static

Returns a sine wave

Parameters
ffoundamental frequency (Hz)
amplitudeamplitude


Parameters
fssampling rate (Hz)
samplessize of the wave

◆ Square()

static double [] dsp.Generator.Square ( double  f,
double  amplitude,
double  fs,
int  components,
int  samples 
)
static

Returns a square wave

Parameters
ffoundamental frequency (Hz)
amplitudeamplitude
fssampling rate (Hz)
componentsnumber of harmonic components
samplessize of the wave

◆ Triangle()

static double [] dsp.Generator.Triangle ( double  f,
double  amplitude,
double  fs,
int  components,
int  samples 
)
static

Returns a triangle wave

Parameters
ffoundamental frequency (Hz)
amplitudeamplitude
fssampling rate (Hz)
componentsnumber of harmonic components
samplessize of the wave