Validates if frequencies are Fourier frequencies from [0,pi].
Validates if frequencies are Fourier frequencies from [0,pi].
Validation of the parameter freq is perfomed in six steps:
Throw an error if parameter is not a vector or not numeric.
Transform each element w of the vector to [0,2pi), by replacing it with wmod2pi.
Check whether all elements w of the vector are Fourier frequency 2pij/T, j∈Z. If this is not the case issue a warning and round each frequency to the next Fourier frequency of the mentioned type; the smaller one, if there are two.
Transform each element w with pi\<w\<2pi of the vector to [0,pi], by replacing it with 2pi−w.
Check for doubles and remove all but the first appearance.
Sort in ascending order.
Any subset of the six steps can be chosen, but 1 should almost always be among the steps to be performed.
frequenciesValidator(freq, N, steps =1:6)
Arguments
freq: the vector of frequencies to be validated.
N: the base of the Fourier frequencies against which the values in freq will be compared.
steps: a vector containing a subset of {1,2,3,4,5,6}, indicating which of the steps are to be performed.
Returns
Returns a vector of Fourier frequencies that is yield by the transformations described above.