Exemple #1
0
        /// <summary>
        /// Recomputes the time series as the sums of seqential values of the original series.
        /// </summary>
        /// <param name="c">The constant to be added to the first value.</param>
        /// <seealso cref="Difference"/>
        public void Integrate(double c)
        {
            if (data.Count < 1)
            {
                throw new InsufficientDataException();
            }

            SampleStorage newData = new SampleStorage();

            newData.Add(data[0] + c);
            for (int i = 1; i < data.Count; i++)
            {
                newData.Add(data[i] + newData[i - 1]);
            }

            data = newData;
        }
Exemple #2
0
        // manipulation methods

        /// <summary>
        /// Adds a data point to the sample.
        /// </summary>
        /// <param name="x">The x-value of the data point.</param>
        /// <param name="y">The y-value of the data point.</param>
        public void Add(double x, double y)
        {
            if (isReadOnly)
            {
                throw new InvalidOperationException();
            }
            else
            {
                xData.Add(x);
                yData.Add(y);
            }
        }
Exemple #3
0
        /// <summary>
        /// Recomputes the time series as the differences between sequential values of the original series.
        /// </summary>
        /// <remarks>
        /// <para>Differencing decreases the number of values in the series by one.</para>
        /// </remarks>
        /// <seealso cref="Integrate"/>
        public void Difference()
        {
            if (data.Count < 2)
            {
                throw new InsufficientDataException();
            }

            SampleStorage newData = new SampleStorage();

            for (int i = 1; i < data.Count; i++)
            {
                newData.Add(data[i] - data[i - 1]);
            }

            data = newData;
        }
Exemple #4
0
 /// <summary>
 /// Adds a point to the time series.
 /// </summary>
 /// <param name="value">The value to add.</param>
 public void Add(double value)
 {
     data.Add(value);
 }