Class TimeSeriesCreator
Class for static methods create different types of time-series for testing.
Inherited Members
Namespace: TimeSeriesAnalysis.Utility
Assembly: TimeSeriesAnalysis.dll
Syntax
public static class TimeSeriesCreator
Methods
| Edit this page View SourceConcat(double[], double[])
Combine to signals of length N1 and N2 into a new signal of length N1+N2
Declaration
public static double[] Concat(double[] u1, double[] u2)
Parameters
Type | Name | Description |
---|---|---|
double[] | u1 | |
double[] | u2 |
Returns
Type | Description |
---|---|
double[] |
Constant(double, int)
Creates a vector of a constant value
Declaration
public static double[] Constant(double value, int N)
Parameters
Type | Name | Description |
---|---|---|
double | value | constant value of time-series |
int | N | number of data points of time-series |
Returns
Type | Description |
---|---|
double[] |
CreateDateStampArray(DateTime, int, int)
Create an array of DateTimes starting at t0
of length N and with sampling interval dT_s
Declaration
public static DateTime[] CreateDateStampArray(DateTime t0, int dT_s, int N)
Parameters
Type | Name | Description |
---|---|---|
DateTime | t0 | first datetime in the array to be created |
int | dT_s | sampling internval |
int | N | number of desired data points |
Returns
Type | Description |
---|---|
DateTime[] |
Noise(int, double, int?)
Create a white-noise random time-series
Declaration
public static double[] Noise(int N, double noiseAmplitude, int? seed = null)
Parameters
Type | Name | Description |
---|---|---|
int | N | |
double | noiseAmplitude | |
int? | seed |
Returns
Type | Description |
---|---|
double[] |
Ramp(int, double, double, int, int)
Create a ramp that starts at startVal and ends at endVal over N
Declaration
public static double[] Ramp(int nRamp, double startVal, double endVal, int nPadBegin = 0, int nPadEnd = 0)
Parameters
Type | Name | Description |
---|---|---|
int | nRamp | the length in samples of the ramp(first value is startVal and lastVal is endVal) |
double | startVal | |
double | endVal | |
int | nPadBegin | the number of samples to pad the signal at the beginning with startVal |
int | nPadEnd | the number of samples to pad the signal at the end with endVal |
Returns
Type | Description |
---|---|
double[] |
RandomWalk(int, double, double, int?)
Creates a random-walk time-series
Declaration
public static double[] RandomWalk(int N, double stepAmplitude, double startval = 0, int? seed = null)
Parameters
Type | Name | Description |
---|---|---|
int | N | |
double | stepAmplitude | |
double | startval | |
int? | seed |
Returns
Type | Description |
---|---|
double[] |
Sinus(double, double, int, int)
Create an array representing a sinus
Declaration
public static double[] Sinus(double amplitude, double sinusPeriod_s, int dT_s, int N)
Parameters
Type | Name | Description |
---|---|---|
double | amplitude | amplitud of sinus |
double | sinusPeriod_s | time for a complete 360 degree period of the sinus in seconds |
int | dT_s | the timebase |
int | N | number of desired data point in return array |
Returns
Type | Description |
---|---|
double[] | an array continaing the specified sinus |
Step(int, int, double, double)
Create a step change vector of a given length N
starting at value
val1
and ending at val2
, step occuring at index stepStartIdx
Declaration
public static double[] Step(int stepStartIdx, int N, double val1, double val2)
Parameters
Type | Name | Description |
---|---|---|
int | stepStartIdx | index of step |
int | N | total time series length |
double | val1 | value before step |
double | val2 | value after step |
Returns
Type | Description |
---|---|
double[] | created vector, or |
ThreeSteps(int, int, int, int, double, double, double, double)
Create a time-series with three step changes
Declaration
public static double[] ThreeSteps(int step1StartIdx, int step2StartIdx, int step3StartIdx, int N, double val1, double val2, double val3, double val4)
Parameters
Type | Name | Description |
---|---|---|
int | step1StartIdx | |
int | step2StartIdx | |
int | step3StartIdx | |
int | N | |
double | val1 | |
double | val2 | |
double | val3 | |
double | val4 |
Returns
Type | Description |
---|---|
double[] |
TwoSteps(int, int, int, double, double, double)
Create a time-series with two step changes
Declaration
public static double[] TwoSteps(int step1StartIdx, int step2StartIdx, int N, double val1, double val2, double val3)
Parameters
Type | Name | Description |
---|---|---|
int | step1StartIdx | index of first step change |
int | step2StartIdx | index of second step change |
int | N | |
double | val1 | value before steps |
double | val2 | value of first step |
double | val3 | value of second step |
Returns
Type | Description |
---|---|
double[] |