It is prudent to question whether a code module is “correct.” Verification and validation (V&V) activities are performed to build confidence in the correct functionality of a code module. Several V&V activities were described in Section 3.7 for the general-purpose DFT function dftasdphi.m. The results of selected verification activities were displayed in Fig. 3.7; those results were generated by the following source file, dftasdphi_vandv.m. Several other verification activities are contained in dftasdphi_vandv.m, described by comments in the source code. The results of a sinusoidal frequency sweep are illustrated in Fig. 3.7, with each frequency in the sweep corresponding to a Fourier basis component. The results shown in Fig. 3.7 were also obtained by keeping the other three sinusoidal parameters fixed. In particular, the sample size was an integer power of 2, so a FFT algorithm was used by the general DFT calculator. Additional V&V value would be achieved by running the same frequency sweep with an odd sample size. Independent sweeps across a range of the other three parameter values might also be helpful. In addition to parameter sweeps, dftasdphi_vandv.m also performs a series of inverse DFT tests, using the output of dftasdphi.m to reconstruct the input signal. If dftasdphi.m is working properly, then the input signal should be recoverable using an inverse DFT, and the difference between the original signal and the recovered signal should be within some bounds determined by machine precision. The inverse DFT check is performed with a sample size that is an integer power of 2, and with an odd sample size.
Appendix: MATLAB Source Code: Validation and Verification