LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer Function

My lab is trying to put together a transfer function for a circuit. Because the board I have can't output in the required frequencies, the signal is begin generated by a signal generator being controlled by hand. We're generating signals at 6,10,20,60,100,200 etc. Hz, all the way up to about 100kHz. Now, I'm hoping to use the TransferFunction function in the Advanced Analysis library to do most of the work for me, but I completely do not understand its documentation, nor do I understand the documentation of the FFT function it's supposedly based on. For example, when I run the following code:
 
#include <analysis.h>  
static double mag[1024];
static double df;
static double phase[1024];
static double SineTwo[1024];
static double sineOne[1024];
int main()
{
 SinePattern (1024, 1.0, 0.0, 15.0, sineOne);
 SinePattern (1024, 1.45, 47.0, 15.0, SineTwo);
 SinePattern(1024,1.0,0.0,1.0,sineThree);
 TransferFunction (sineOne, SineTwo, 1024, (1.0/1024.0), mag, phase,
       &df);
 return 0; 
}
 
and breakpoint on the return statement, the phase and mag arrays look nothing like I hoped.
 
Right now we're using an oscilloscope and having to calibrate it to each frequency and loaboriously take the measurements by hand. If I can get this program up and running it'll help alot.
Using: Labwindows/CVI 6.0 with a Multifunction DAQ (PCI-6036E)
0 Kudos
Message 1 of 4
(3,207 Views)

Are you intending for your dt value (the 1/1024) to be that value?

If so, at the end of execution, are you getting the value of 1 returned in variable "df"?

df = 1/(# elements * dt) which in your case is 1/( 1024 * 1/1024), which is 1/1, which is 1.

Just random sanity checks for now because everything else is just pure function calls........

0 Kudos
Message 2 of 4
(3,195 Views)
I am getting 1 for the df - I wasn't aware of that formula before.  I had no idea that the number of points taken effected the frequency range.  If I manage to increase or decrease df will it be good or bad for me?

Yet I'm still confused, and I'm not even sure what I'm confused about. For example, I'm reading the page http://zone.ni.com/devzone/conceptd.nsf/webmain/C045A890751303A6862568650061EA98#5, and I'm fine until it gets to the part that tells me to use the FFT function. What do I give the function - do I put a reference to a signal acquired from the DAQ in the REAL input and expect that the new real and imaginary inputs will be generated from it? What does transferFunction actually do?
-Jason Espinosa

LabWindows 6.0
PCI-6036E
0 Kudos
Message 3 of 4
(3,187 Views)
You cannot increase (per se) df because it is an output.  Obviously, you can change it by varying dt as an input.
dt should be your sampling PERIOD in seconds.  dt = 1/fs where fs is the sampling frequency of the time-domain signals.
Most of this is from the CVI help page.  Use the index tab and type in TransferFunction to see the expected I/O to the call.
I am *guessing* that you are using dt in error.
0 Kudos
Message 4 of 4
(3,182 Views)