Click or drag to resize

Real

Performs 1-dimensional discrete Fourier transform of real forward domain.

If {x} are real numbers, as they often are in practical applications, then the DFT obeys the symmetry:

SPSymmetry

The star denotes complex conjugation.

Therefore, the DFT output for real inputs is half redundant, and one obtains the complete information by only looking at roughly half of the outputs SPOutputs. In this case, element X0 is purely real, and for even N the element XN / 2 is also real.

This topic contains the following sections:

Constructor

Constructor

Description

Performance

set the length of sequences to be used

Initializes an instance of RealDFT1D class that allows to compute forward and backward (inverse) DFT of given length.

methodRealDFT1D(Int32)

Methods
Properties

Property

Description

Performance

forward scale factor

A scale factor for forward transform.

PropertyForwardScaleFactor

backward scale factor

A scale factor for backward transform.

PropertyBackwardScaleFactor

Code Sample

Computation of forward and backward transform:

C#
 1using System;
 2using FinMath.SignalProcessing;
 3using FinMath.Statistics;
 4
 5namespace FinMath.Samples
 6{
 7    class FourierTransformReal
 8    {
 9        static void Main()
10        {
11            // Create random generator.
12            RandomGenerator random = new RandomGenerator();
13
14            // Create arrays.
15            Double[] input = new Double[7];
16            Complex[] output = new Complex[7];
17            Double[] result = new Double[7];
18
19            // Generate random series of numbers.
20            random.NextSeries(input);
21            Console.WriteLine("Input = ");
22            Console.Write(input[0].ToString("0.000"));
23            for (Int32 i = 1; i < input.Length; ++i)
24                Console.Write(", " + input[i].ToString("0.000"));
25            Console.WriteLine(Environment.NewLine);
26
27            // Create a new instance of RealDFT1D.
28            RealDFT1D dft = new RealDFT1D(7);
29
30            // Set forward and backward scale factors.
31            dft.ForwardScaleFactor = 1.0 / 7;
32            dft.BackwardScaleFactor = 1.0;
33
34            // Compute forward transform.
35            dft.ComputeForward(input, output);
36            Console.WriteLine("Output = ");
37            Console.Write(output[0].ToString("0.000"));
38            for (Int32 i = 1; i < output.Length; ++i)
39                Console.Write(", " + output[i].ToString("0.000"));
40            Console.WriteLine(Environment.NewLine);
41
42            // Compute backward transform.
43            dft.ComputeBackward(output, result);
44            Console.WriteLine("Result = ");
45            Console.Write(result[0].ToString("0.000"));
46            for (Int32 i = 1; i < result.Length; ++i)
47                Console.Write(", " + result[i].ToString("0.000"));
48            Console.WriteLine(Environment.NewLine);
49        }
50    }
51}

See Also