# 2.1.22.2.1.40 fft_sampling_resolution

## Description

Check the sampling resolution of the frequencies and return the interval of the sequence.

## Syntax

int fft_sampling_resolution( int iSize, double * vFreq, double * dTimeInterval )

## Parameters

iSize
[input] the number of data values in the sequence.
vFreq
[input] sequence to be checked.
dTimeInterval
[output] the time interval of the sequence.

## Return

returns 0 for evenly spaced frequencies and error codes

INVALID_SIZE: the size of the sequency is less than 2

INVALID_INTERVAL: invalid interval -- the interval is less than 1e-20

UNEVENLY_SPACE: unevenly spaced values.

## Examples

EX1

//Assume the current column one is the time sequence. This piece of code get the time    inte-
//rval and tell wheather the elements of time sequence are uniformly spaced or not.

#include <..\originlab\fft.h>
void TEST_fft_sampling_resolution()
{
double dTimeInterval;
Worksheet wks = Project.ActiveLayer();
if(wks)
{
Dataset dsTime(wks, 0);

vector vTime = dsTime;
int ret;
ret = fft_sampling_resolution(dsTime.GetSize(), vTime, &dTimeInterval);
if (ret != 0)
out_str("Elements of time sequence are not uniformly spaced");
// then dTimeInterval is the value of time interval of time sequence
}
}