# Coefficient-of-Determination Fourier Transform

^{†}

## Abstract

**:**

## 1. Introduction

## 2. Spectral Transform

## 3. Spectral Transform Algorithm

`% MatLab code of the CFT algorithm`

`% FFO is the function in the temporal domain. Sfct is a discrete function`

`% of frequencies, selected by the user, to define the spectral domain`

`FFavg=mean(FF0); FFstd=max(FF0)-min(FF0);`

`for ii=2:ct`

`sinfct=sin(2∗pi∗t∗(Sfct(ii))); % Real cosine function`

`cosfct=cos(2∗pi∗t∗(Sfct(ii))); % Imaginary sine function`

`corrR=R2fct(cosfct,FF0); % R^2 of real component`

`corrI=R2fct(sinfct,FF0); % R^2 of imaginary component`

`SpecFct(ii)=corrR+(i∗corrI); % Saving the Spectral Function`

`end`

`SpecFct=FFstd∗SpecFct/(sum(abs(SpecFct))); % Normalize the spectral function`

`SpecFct(1)=FFavg; % Set the average of the temporal function (Sfct(1)=0)`

`% Correlation Coefficient Function`

`function [R2]=R2fct(X,Y)`

`ctx=length(X); foo=zeros(ctx,3);`

`for ii=1:ctx`

`foo(ii,1)=(X(ii)-(mean(X)))∗(Y(ii)-(mean(Y)));`

`foo(ii,2)=(X(ii)-(mean(X)))^2;`

`foo(ii,3)=(Y(ii)-(mean(Y)))^2;`

`end`

`foo=sum(foo);`

`foo2=(sqrt((foo(2))∗(foo(3))));`

`if foo2==0`

`corr=0;`

`else`

`corr=foo(1)/foo2; % Closer to 1 is best`

`end`

`R2=corr^2;`

`end`

`% MatLab code of the inverse CFT algorithm`

`% Ftest = temporal output function, of discrete length ctT`

`% t = time domain of discrete length ctT`

`% SpecFct = spectral function of discrete length ct to be transformed`

`% back to the temporal domain`

`Ftest=zeros(ctT,1);`

`for ii=1:ct`

`Ftest=((real(SpecFct(ii)))∗cos(2∗pi∗t∗Sfct(ii)))+Ftest;`

`Ftest=((imag(SpecFct(ii)))∗sin(2∗pi∗t∗Sfct(ii)))+Ftest;`

`end`

## 4. Initial Demonstration of the Spectral Transform Algorithm

## 5. Performance of the Spectral Transform Algorithm

## 6. Parametric Study of the Spectral Transform Algorithm

## 7. Conclusions

## Supplementary Materials

## Funding

## Acknowledgments

## Conflicts of Interest

## Abbreviations

MDPI | Multidisciplinary Digital Publishing Institute |

DOAJ | Directory of open access journals |

DFT | Discrete Fourier Transform |

FFT | Fast Fourier Transform |

NDFT | Non-uniform Discrete Fourier Transform |

CFT | Coefficient of determination Fourier Transform |

$f\left(t\right)$ | Generic temporal function of time t. |

F($\omega $) | Generic spectral function of frequency $\omega $. |

${\omega}_{n}$ | a discrete spectral value of the frequency |

${t}_{n}$ | a discrete temporal value of the time domain |

$f\left({t}_{n}\right)$ | a discrete value of the temporal function $f\left(t\right)$ |

${p}_{n}$ | arbitrary temporal resolution for NDFT |

${\mathsf{\Phi}}_{k}$(t) | Cosine function to represent real discrete spectral magnitude as related to ${\omega}_{k}$ (Equation (7)) |

${\widehat{\mathsf{\Phi}}}_{k}$(t) | Sine function to represent imaginary discrete spectral magnitude (Equation (7)) |

A | Amplitude of functions ${\mathsf{\Phi}}_{k}$(t) and ${\widehat{\mathsf{\Phi}}}_{k}$(t) (Equation (8)) |

$G\left({t}_{n}\right)$ | arbitrary function of discrete temporal value ${t}_{n}$. $\overline{G}$ is the mean of $G\left({t}_{n}\right)$. |

$H\left({t}_{n}\right)$ | arbitrary function of discrete temporal value ${t}_{n}$. $\overline{H}$ is the mean of $H\left({t}_{n}\right)$. |

## References

- Nagel, R.K.; Saff, E.B.; Snider, A.D. Fundamentals of Differential Equations, 5th ed.; Addison Wesley: Boston, MA, USA, 1999. [Google Scholar]
- Haberman, R. Applied Partial Differential Equations with Fourier Series and Boundary Value Problems, 4th ed.; Prentice Hall: Upper Saddle River, NJ, USA, 2003. [Google Scholar]
- Harris, F.J. On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform. Proc. IEEE
**1978**, 66, 51–83. [Google Scholar] [CrossRef] - Dorrer, C.; Belabas, N.; Likforman, J.P.; Joffre, M. Spectral resolution and sampling issues in Fourier-transform spectral interferometry. J. Opt. Soc. Am. B
**2000**, 17, 1795–1802. [Google Scholar] [CrossRef] - Arfken, G.B.; Weber, H.J. Mathematical Methods for Physicists, 6th ed.; Elsevier: Burlington, MA, USA, 2005. [Google Scholar]
- Zill, D.G.; Cullen, M.R. Advanced Engineering Mathematics, 2nd ed.; Jones and Bartlett Publishers: Sudbury, MA, USA, 2000. [Google Scholar]
- Numerical Recipies in C: The Art of Scientific Computing; Cambridge University Press: Cambridge, UK, 1988; Chapter 13; pp. 584–591. ISBN 0-521-4310805.
- Chen, W.H.; Smith, C.H.; Fralick, S.C. A Fast Computational Algorithm for the Discrete Cosine Transform. IEEE Trans. Commun.
**1977**, 25, 1004–1009. [Google Scholar] [CrossRef] - Agarwal, R.C. A New Least-Squares Refinement Technique Based on the Fast Fourier Transform Algorithm. Acta Cryst.
**1978**, 34, 791–809. [Google Scholar] [CrossRef] - Finzel, B. Incorporation of fast Fourier transforms to speed restrained least-squares refinement of protein structures. J. Appl. Cryst.
**1986**, 20, 53–55. [Google Scholar] [CrossRef] - Garcia, A. Numerical Methods for Physics, 2nd ed.; Addison-Wesley: Boston, MA, USA, 1999. [Google Scholar]
- Poon, T.C.; Kim, T. Engineering Optics With Matlab; World Scientific Publishing Co.: Hackensack, NJ, USA, 2006. [Google Scholar]
- Nyquist, H. Certain Topics in Telegraph Transmission Theory. Proc. IEEE
**2002**, 90, 280–305. [Google Scholar] [CrossRef] - Landau, H.J. Necessary Density Conditions for Sampling and Interpolation of Certain Entire Functions. Acta Math.
**1967**, 117, 37–52. [Google Scholar] [CrossRef] - Shannon, C.E. Communication in the Presence of Noise. Proc. IEEE
**1998**, 86, 447–457. [Google Scholar] [CrossRef] - Luke, H.D. The Origins of the Sampling Theorem. IEEE Commun. Mag.
**1999**, 37, 106–108. [Google Scholar] [CrossRef] - Kupfmuller, K. On the Dynamics of Automatic Gain Controllers. Elektr. Nachrichtentech.
**2005**, 5, 459–467. [Google Scholar] - Harvey, J. Fourier treatment of near-field scalar diffraction theory. Am. J. Phys.
**1979**, 47, 974–980. [Google Scholar] [CrossRef] - Jiang, D.; Stamnes, J.J. Numerical and experimental results for focusing of two-dimensional electromagnetic waves into uniaxial crystals. Opt. Commun.
**2000**, 174, 321–334. [Google Scholar] [CrossRef] - Stamnes, J.J.; Jiang, D. Focusing of electromagnetic waves into a uniaxial crystal. Opt. Commun.
**1998**, 150, 251–262. [Google Scholar] [CrossRef] - Jiang, D.; Stamnes, J.J. Numerical and asymptotic results for focusing of two-dimensional waves in uniaxial crystals. Opt. Commun.
**1999**, 163, 55–71. [Google Scholar] [CrossRef] - Shen, F.; Wang, A. Fast-Fourier-transform based numerical integration method for the Rayleigh–Sommerfeld diffraction formula. Appl. Opt.
**2006**, 45, 1102–1110. [Google Scholar] [CrossRef] [PubMed] - Boyd, J.P. A Fast Algorithm for Chebyshev, Fourier, and Sine Interpolation onto an Irregular Grid. J. Comput. Phys.
**1992**, 103, 243–257. [Google Scholar] [CrossRef] - Lee, J.Y.; Greengard, L. The type 3 nonuniform FFT and its applications. J. Comput. Phys.
**2005**, 206, 1–5. [Google Scholar] [CrossRef] - Dutt, A. Fast Fourier Transforms for Nonequispaced Data. Ph.D. Thesis, Yale University, New Haven, CT, USA, 1993. [Google Scholar]
- Dutt, A.; Rokhlin, V. Fast Fourier Transforms for Nonequispaced Data II. SIAM J. Sci. Ccomput.
**1993**, 14, 1368–1393. [Google Scholar] [CrossRef] - Dutt, A.; Rokhlin, V. Fast Fourier Transforms for Nonequispaced Data II. Appl. Comput. Harmon. Anal.
**1995**, 2, 85–100. [Google Scholar] [CrossRef] - Greengard, L.; Lee, J.Y. Accelerating the Nonuniform Fast Fourier Transform. SIAM Rev.
**2004**, 46, 443–454. [Google Scholar] [CrossRef] [Green Version] - Dohler, M.; Kunis, S.; Potts, D. Nonequispaced Hyperbolic Cross Fast Fourier Transform. SIAM J. Numer. Anal.
**2010**, 47, 4415–4428. [Google Scholar] [CrossRef] [Green Version] - Fessler, J.A.; Sutton, B.P. Nonuniform Fast Fourier Transforms Using Min-Max Interpolation. IEEE Trans. Signal Process.
**2003**, 51, 560–574. [Google Scholar] [CrossRef] - Ruiz-Antolin, D.; Townsend, A. A Nonuniform Fast Fourier Transform Based on Low Rank Approximation. SIAM J. Sci. Comput.
**2018**, 40, 529–547. [Google Scholar] [CrossRef] - Cameron, A.C.; Windmeijer, F.A. An R-squared measure of goodness of fit for some common nonlinear regression models. J. Econ.
**1997**, 77, 329–342. [Google Scholar] [CrossRef] - Magee, L. R2 Measures Based on Wald and Likelihood Ratio Joint Significance Tests. Am. Stat.
**1990**, 44, 250–253. [Google Scholar] - Nagelkerke, N.J.D. A note on a general definition of the coefficient of determination. Biomelrika
**1991**, 78, 691–692. [Google Scholar] [CrossRef] - Strang, G. Introduction to Linear Algebra, 3rd ed.; Wellesley-Cambridge Press: Wellesley, MA, USA, 2003. [Google Scholar]

**Figure 2.**Spectral results of the function $\mathrm{cos}(2\mathsf{\pi}\xb7x)$ with a $\delta $s = 0.1, with both the proposed CFT in magnitude (

**a**) and phase (

**b**), as well as NDFT in magnitude (

**c**) and phase (

**d**).

**Figure 3.**Demonstration of the function $\mathrm{cos}(2\mathsf{\pi}\xb7t)$, both the original function (solid green lines), and the output (blue circles) obtained from Equation (12) and the CFT spectral results, obtained with a limited initial temporal resolution of $\delta t=0.1$.

**Figure 4.**Performance data for an input temporal plot of 101 data points of resolution: (

**a**) a comparison of the data to the true, high resolution function; (

**b**) the spectral function, both the CFT and a tradition FFT analysis; and (

**c**) the original versus the inverse transform of the spectral function.

**Figure 5.**Spectral results of the randomly generated functions, for frequencies of: (

**a**) 2.0256 (Hz/Rev); and (

**b**) 13.0467 (Hz/Rev), but for different phases, magnitudes, and random noises.

**Figure 8.**Time results of the randomly generated functions, for frequencies of: (

**a**) 2.0256 (Hz/Rev); and (

**b**) 13.0467 (Hz/Rev), but for different phases, magnitudes, and random noises.

x | f = 1 | f = 9 |
---|---|---|

0.0 | 1.0000 | 1.0000 |

0.1 | 0.8090 | 0.8090 |

0.2 | 0.3090 | 0.3090 |

0.3 | −0.3090 | −0.3090 |

0.4 | −0.8090 | −0.8090 |

0.5 | −1.0000 | −1.0000 |

0.6 | −0.8090 | −0.8090 |

0.7 | −0.3090 | −0.3090 |

0.8 | 0.3090 | 0.3090 |

0.9 | 0.8090 | 0.8090 |

1.0 | 1.0000 | 1.0000 |

f (Hz) | Phase | ${\mathit{R}}^{2}$ CFT | ${\mathit{R}}^{2}$ NDFT |
---|---|---|---|

1 | 0 | 0.9999 | 0.1197 |

ine 1 | 2$\xb7\mathsf{\pi}$/3 | 0.9967 | 0.0091 |

1 | $-2\xb7\mathsf{\pi}$/3 | 0.9964 | 0.0163 |

ine 9 | 0 | 0.9999 | 0.1197 |

9 | 2$\xb7\mathsf{\pi}$/3 | 0.9964 | 0.0163 |

9 | $-2\xb7\mathsf{\pi}$/3 | 0.9967 | 0.0091 |

**Table 3.**Performance results of peak frequency, comparing CFT versus FFT, with a temporal resolution of 101.

True Frequency (Hz) | CFT Frequency (Hz) | FFT Frequency (Hz) | NDFT Frequency (Hz) |
---|---|---|---|

20.8 | 22.42 | 23.5294 | 22.63 |

38.38 | 38.58 | 39.2157 | 38.98 |

61.38 | 61.42 | - | 62.02 |

77.55 | 77.58 | - | 78.37 |

Test | Max Freq | Max Freq | Sin(Phase) | Sin(Phase) | ${\mathit{R}}^{2}$ |
---|---|---|---|---|---|

Original | CFT Result | Original | CFT Result | (Temporal) | |

1 | 2.0256 | 2.095 | −0.72837 | −0.56129 | 0.92791 |

2 | 10.6771 | 10.678 | 0.88707 | 0.88349 | 0.94843 |

3 | 5.5118 | 5.537 | 0.82648 | 0.76277 | 0.94092 |

4 | 11.1441 | 11.146 | 0.32585 | 0.30499 | 0.93117 |

5 | 4.1527 | 4.137 | 0.020562 | 0.14696 | 0.93132 |

6 | 13.0467 | 13.05 | 0.94015 | 0.94829 | 0.93359 |

7 | 11.9742 | 11.973 | −0.31888 | −0.32338 | 0.92769 |

8 | 11.3472 | 11.339 | 0.78318 | 0.78725 | 0.93398 |

9 | 12.5892 | 12.578 | −0.35645 | −0.31945 | 0.93956 |

10 | 11.128 | 11.122 | 0.90871 | 0.90812 | 0.92836 |

11 | 3.9531 | 3.954 | −0.20131 | −0.20166 | 0.93636 |

12 | 5.6981 | 5.677 | 0.080619 | 0.14678 | 0.93363 |

13 | 16.1721 | 16.158 | 0.38625 | 0.41684 | 0.94243 |

14 | 12.2989 | 12.32 | 0.57446 | 0.63023 | 0.93483 |

15 | 10.0715 | 10.085 | −0.43758 | −0.3967 | 0.92398 |

Test | Max Freq | Max Freq | Sin(Phase) | Sin(Phase) | ${\mathit{R}}^{2}$ |
---|---|---|---|---|---|

Original | CFT Result | Original | CFT Result | (Temporal) | |

1 | 2.0256 | 2.026 | −0.062681 | $-0.$056313 | 0.93311 |

2 | 10.6771 | 10.658 | 0.25575 | 0.18466 | 0.93944 |

3 | 5.5118 | 5.511 | 0.54959 | 0.54223 | 0.9434 |

4 | 11.1441 | 11.166 | $-0.$90216 | $-0.$87023 | 0.93194 |

5 | 4.1527 | 4.141 | $-0.$92686 | $-0.$92268 | 0.92885 |

6 | 13.0467 | 13.031 | $-0.$64986 | $-0.$6287 | 0.92476 |

7 | 11.9742 | 11.97 | $-0.$95715 | $-0.$95146 | 0.93294 |

8 | 11.3472 | 11.344 | 0.16368 | 0.17658 | 0.92725 |

9 | 12.5892 | 12.593 | $-0.$25732 | $-0.$23808 | 0.94473 |

10 | 11.128 | 11.145 | 0.86293 | 0.90011 | 0.93841 |

11 | 3.9531 | 3.97 | 0.65591 | 0.69795 | 0.94498 |

12 | 5.6981 | 5.7 | $-0.$62372 | $-0.$63233 | 0.93151 |

13 | 16.1721 | 16.169 | 0.76013 | 0.75789 | 0.93039 |

14 | 12.2989 | 12.31 | $-0.$99804 | $-1$ | 0.93751 |

15 | 10.0715 | 10.084 | 0.9865 | 0.98098 | 0.9411 |

Test | Max Freq | Max Freq | Sin(Phase) | Sin(Phase) | ${\mathit{R}}^{2}$ |
---|---|---|---|---|---|

Original | CFT Result | Original | CFT Result | (Temporal) | |

1 | 2.0256 | 2.009 | $-0.$81562 | $-0.$79053 | 0.93367 |

2 | 10.6771 | 10.666 | 0.58339 | 0.5697 | 0.92987 |

3 | 5.5118 | 5.53 | 0.72393 | 0.68535 | 0.93461 |

4 | 11.1441 | 11.154 | $-0.$99286 | $-0.$99909 | 0.92839 |

5 | 4.1527 | 4.122 | $-0.$3222 | $-0.$20013 | 0.95071 |

6 | 13.0467 | 13.04 | $-0.$90228 | $-0.$88856 | 0.94272 |

7 | 11.9742 | 11.958 | $-0.$86461 | $-0.$82531 | 0.93705 |

8 | 11.3472 | 11.347 | $-0.$85766 | $-0.$86378 | 0.93519 |

9 | 12.5892 | 12.588 | $-0.$66127 | $-0.$67959 | 0.92307 |

10 | 11.128 | 11.152 | $-0.$9832 | $-0.$96008 | 0.9276 |

11 | 3.9531 | 3.969 | $-0.$9574 | $-0.$96818 | 0.9428 |

12 | 5.6981 | 5.734 | $-0.$99907 | $-0.$9842 | 0.94156 |

13 | 16.1721 | 16.183 | 0.85337 | 0.82142 | 0.93247 |

14 | 12.2989 | 12.296 | $-0.$86634 | $-0.$85394 | 0.92086 |

15 | 10.0715 | 10.075 | $-0.$94753 | $-0.$9473 | 0.94203 |

© 2018 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Marko, M.D.
Coefficient-of-Determination Fourier Transform. *Computation* **2018**, *6*, 61.
https://doi.org/10.3390/computation6040061

**AMA Style**

Marko MD.
Coefficient-of-Determination Fourier Transform. *Computation*. 2018; 6(4):61.
https://doi.org/10.3390/computation6040061

**Chicago/Turabian Style**

Marko, Matthew David.
2018. "Coefficient-of-Determination Fourier Transform" *Computation* 6, no. 4: 61.
https://doi.org/10.3390/computation6040061