frequenciesValidator function

Validates if frequencies are Fourier frequencies from [0,pi][0,pi].

Validates if frequencies are Fourier frequencies from [0,pi][0,pi].

Validation of the parameter freq is perfomed in six steps:

  1. Throw an error if parameter is not a vector or not numeric.
  2. Transform each element ww of the vector to [0,2pi)[0,2pi), by replacing it with wmod2piw mod 2pi.
  3. Check whether all elements ww of the vector are Fourier frequency 2pij/T2 pi j / T, jZj \in 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.
  4. Transform each element ww with pi\<w\<2pipi \< w \< 2pi of the vector to [0,pi][0,pi], by replacing it with 2piw2pi - w.
  5. Check for doubles and remove all but the first appearance.
  6. 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}\{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.

Examples

freq <- 2*pi*c(3,2,5,8,9)/10 res <- frequenciesValidator(freq, N=10, steps=1:3) res * 10 / (2*pi) # Returns: [1] 3 2 5 8 9 res <- frequenciesValidator(freq, N=10, steps=1:4) res * 10 / (2*pi) # Returns: [1] 3 2 5 2 1 res <- frequenciesValidator(freq, N=10, steps=1:5) res * 10 / (2*pi) # Returns: [1] 3 2 5 1 res <- frequenciesValidator(freq, N=10, steps=1:6) res * 10 / (2*pi) # Returns: [1] 1 2 3 5
  • Maintainer: Tobias Kley
  • License: GPL (>= 2)
  • Last published: 2024-07-11

Downloads (last 30 days):