LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

divide a frequency range logarithmically

I'm writing a program that generates voltage sinusoidally over a range of frequencies, reads it after the signal is changed somehow, and does some computations on the results (ratios of frequencies and phases).


Now, the frequency ranges I'm dealing with are going to be something on the order of say, 100-100k Hz. The user specifies n samples they want taken over that frequency range. Now, if I want any useful information out of this experiment I'm not going to divide the frequency range linearly by n. I'm going to have to  divide it up logarithmically somehow. Now, the two questions I can't wrap my brain around for some reason:

What's the best algorithm to divide them up?

How would I implement it?

(And, better yet, is there a pre-defined function for it?)

I'm using LabWindows/CVI 6.0, and I happen to have the "toolbox.fp" loaded, if that helps.

I'd greatly appreciate any responses.
-Jason Espinosa

LabWindows 6.0
PCI-6036E
0 Kudos
Message 1 of 3
(3,249 Views)

How about something along the lines:

double ratio, fmax, fmin, freq;
int steps, loop;

ratio = pow (fmin / fmax, 1.0 / steps);
freq = fmin;
for (loop = 0; loop <= steps; loop++) {
    // Use the value of freq in your algorithms
    freq /= ratio;    // Next log step
}

JR

0 Kudos
Message 2 of 3
(3,244 Views)
Thanks for the quick response. I'm going to try it and see if it fits my boss's needs 🙂
-Jason Espinosa

LabWindows 6.0
PCI-6036E
0 Kudos
Message 3 of 3
(3,239 Views)