Esempio n. 1
0
        }         // forward

        //   * The 1-D reverse version of the Discrete Fourier Transform (DFT); The input
        //   * array arrFreq is organized by a class called Complex keeping real and
        //   * imaginary part of a complex number. The output arrTime is organized by the
        //   * same scheme.
        //   *
        //   * @date 23.11.2010 19:02:12
        //   * @author Christian Scheiblich
        //   * @param arrFreq
        //   *          array of type Complex keeping the discrete fourier transform
        //   *          coefficients
        //   * @return array of type Complex keeping coefficients of tiem domain
        public override Complex[] reverse(Complex[] arrFreq)
        {
            int n = arrFreq.Length;

            Complex[] arrTime = new Complex[n];             // result

            for (int i = 0; i < n; i++)
            {
                arrTime[i] = new Complex();                 // 0. , 0.

                double arg = 2.0 * Math.PI * (double)i / (double)n;

                for (int k = 0; k < n; k++)
                {
                    double cos = Math.Cos(k * arg);
                    double sin = Math.Sin(k * arg);

                    double real = arrFreq[k].Re;
                    double imag = arrFreq[k].Im;

                    arrTime[i].Re += (real * cos - imag * sin);
                    arrTime[i].Im += (real * sin + imag * cos);
                }         // k
            }             // i

            return(arrTime);
        }         // reverse
		} // forward

		//   * The 1-D reverse version of the Discrete Fourier Transform (DFT); The input
		//   * array arrFreq is organized by a class called Complex keeping real and
		//   * imaginary part of a complex number. The output arrTime is organized by the
		//   * same scheme.
		//   * 
		//   * @date 23.11.2010 19:02:12
		//   * @author Christian Scheiblich
		//   * @param arrFreq
		//   *          array of type Complex keeping the discrete fourier transform
		//   *          coefficients
		//   * @return array of type Complex keeping coefficients of tiem domain
		public override Complex[] reverse(Complex[] arrFreq)
		{
			int n = arrFreq.Length;
			Complex[] arrTime = new Complex[n]; // result

			for(int i = 0; i < n; i++)
			{
				arrTime[i] = new Complex(); // 0. , 0.

				double arg = 2.0 * Math.PI * (double)i / (double)n;

				for(int k = 0; k < n; k++)
				{
					double cos = Math.Cos(k * arg);
					double sin = Math.Sin(k * arg);

					double real = arrFreq[k].Re;
					double imag = arrFreq[k].Im;

					arrTime[i].Re += (real * cos - imag * sin);
					arrTime[i].Im += (real * sin + imag * cos);

				} // k

			} // i

			return arrTime;
		} // reverse
		} // reverse

		//   * The 1-D forward version of the Discrete Fourier Transform (DFT); The input
		//   * array arrTime is organized by a class called Complex keeping real and
		//   * imaginary part of a complex number. The output arrFreq is organized by the
		//   * same scheme.
		//   * 
		//   * @date 23.11.2010 18:57:34
		//   * @author Christian Scheiblich
		//   * @param arrTime
		//   *          array of type Complex keeping coefficients of complex numbers
		//   * @return array of type Complex keeping the discrete fourier transform
		//   *         coefficients
		public override Complex[] forward(Complex[] arrTime)
		{
			int n = arrTime.Length;

			Complex[] arrFreq = new Complex[n]; // result

			for(int i = 0; i < n; i++)
			{
				arrFreq[i] = new Complex(); // 0. , 0.

				double arg = -2.0 * Math.PI * (double)i / (double)n;

				for(int k = 0; k < n; k++)
				{
					double cos = Math.Cos(k * arg);
					double sin = Math.Sin(k * arg);

					double real = arrTime[k].Re;
					double imag = arrTime[k].Im;

					arrFreq[i].Re += (real * cos - imag * sin);
					arrFreq[i].Im += (real * sin + imag * cos);

				} // k

				arrFreq[i].Re *= (1.0 / (double)n);
				arrFreq[i].Im *= (1.0 / (double)n);

			} // i

			return arrFreq;
		} // forward
		} // forward

		//   * Performs the reverse transform from frequency or Hilbert domain to time
		//   * domain for a given array depending on the used transform algorithm by
		//   * inheritance.
		//   * 
		//   * @date 23.11.2010 19:17:59
		//   * @author Christian Scheiblich
		//   * @param arrFreq
		//   *          coefficients of 1-D frequency or Hilbert domain
		//   * @return coefficients of 1-D time domain
		public virtual Complex[] reverse(Complex[] arrFreq)
		{
			return null;
		} // reverse
		//   * Performs the forward transform from time domain to frequency or Hilbert
		//   * domain for a given array depending on the used transform algorithm by
		//   * inheritance.
		//   * 
		//   * @date 23.11.2010 19:17:46
		//   * @author Christian Scheiblich
		//   * @param arrTime
		//   *          coefficients of 1-D time domain
		//   * @return coefficients of 1-D frequency or Hilbert domain
		public virtual Complex[] forward(Complex[] arrTime)
		{
			return null;
		} // forward
Esempio n. 6
0
		} // forward

		//   * Performs the reverse transform from frequency or Hilbert domain to time
		//   * domain for a given array depending on the used transform algorithm by
		//   * inheritance.
		//   * 
		//   * @date 23.11.2010 19:19:33
		//   * @author Christian Scheiblich
		//   * @param arrFreq
		//   *          coefficients of 1-D frequency or Hilbert domain
		//   * @return coefficients of 1-D time domain
		public virtual Complex[] reverse(Complex[] arrFreq)
		{
			return ((BasicTransform)_transform).reverse(arrFreq);
		} // reverse
Esempio n. 7
0
		} // reverse


		//   * Performs the forward transform from time domain to frequency or Hilbert
		//   * domain for a given array depending on the used transform algorithm by
		//   * inheritance.
		//   * 
		//   * @date 23.11.2010 19:19:24
		//   * @author Christian Scheiblich
		//   * @param arrTime
		//   *          coefficients of 1-D time domain
		//   * @return coefficients of 1-D frequency or Hilbert domain
		public virtual Complex[] forward(Complex[] arrTime)
		{
			return ((BasicTransform)_transform).forward(arrTime);
		} // forward