**.https://nyquist.foxping.com/**=> "

**DFT Images 2 Hz, 0 zeros.pdf**". The intent is to reconstruct a sampled signal (top right side) to be identical to the original signal (top left side).

This code converts a signal to a frequency spectrum (DFT):

C#:

```
public Complex[] acplxConvertSignalToDft(double[] adSignalYValues)
{
int iNumOfValues = adSignalYValues.Length;
Complex[] acplxFrequencies = new Complex[iNumOfValues];
for (int ii = 0; ii < iNumOfValues; ii++)
{
acplxFrequencies[ii] = 0;
for (int iii = 0; iii < iNumOfValues; iii++)
{
acplxFrequencies[ii] += adSignalYValues[iii] *
Complex.Exp(-Complex.ImaginaryOne *
2 * Math.PI * (ii * iii) /
Convert.ToDouble(iNumOfValues));
}
acplxFrequencies[ii] = acplxFrequencies[ii] / iNumOfValues;
}
return acplxFrequencies;
}//acplxConvertSignalToDft
```

This code converts a frequency spectrum into a signal (Inverse DFT):

C#:

```
public double[] adConvertDftToSignal(Complex[] acplxFrequencies)
{
int iNumOfValues = acplxFrequencies.Length;
double[] adInverseDftSignalYValues = new double[iNumOfValues];
for (int ii = 0; ii < iNumOfValues; ii++)
{
Complex cplxSum = 0;
for (int iii = 0; iii < iNumOfValues; iii++)
{
cplxSum += acplxFrequencies[iii] *
Complex.Exp(Complex.ImaginaryOne *
2 * Math.PI * (iii * ii) /
Convert.ToDouble(iNumOfValues));
}
//Use real values imaginary values should be close to zero
adInverseDftSignalYValues[ii] = cplxSum.Real;
}
return adInverseDftSignalYValues;
}//adConvertDftToSignal
```

See

**.https://nyquist.foxping.com/**=> "

**DFT Images 2 Hz, 200 zeros.pdf**". Insert 200 zeros between the max frequency in the middle of the frequency spectrum (middle right side image). Then use Inverse DFT to attempt to reconstruct the original signal.

The reconstructed signal (bottom right side) is similar, but not identical to the original signal (top left side).

I noticed that the frequency spectrum was not perfectly symmetrical => one more point on the left half. I decided to add the first left point to the right side end to make it perfectly symmetrical. See

**.https://nyquist.foxping.com/**=> "

**DFT Images 2 Hz, 200 zeros - added 1st to end.pdf**". This distorts the signal.

Adding the first left point frequency spectrum to the right side end to make it perfectly symmetrical does not fix the problem?