LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Logarithmic Frequency Increment

Hi,
 
Does anyone have code for a Logarithmic frequency increment that permits uniform spacing of the data points, given the start and end frequencies along with the number of points?
 
Any help would be appreciated.
 
regards,
 
D
0 Kudos
Message 1 of 2
(3,245 Views)

You could try something along these lines:

#include <math.h>      // For the pow() function

    double start;      // eg 10
    double end;        // eg 1000
    double points;     // eg 15
    double select;     // the sample point to calculate, eg from 0 to 14
    double value;      // will receive the logarithmic value of the range, at the selected point

    value = start * pow (end / start, select / (points - 1));

Depending on the rest of the application you might want to add some basic error checking.

JR

0 Kudos
Message 2 of 2
(3,220 Views)