LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find frequency response of a circuit using myDAQmx and labview?

Hello,

 

I currently have the myDAQmx USB 6351.

 

I need to plot the phase shift and voltage gain of the circuit (Bode). I use the DAQmx to both record the voltage input as well as the voltage across the capacitor, but I cannot generate the bode plot (picture attached). I have tried many subvis but can't seem to get it to work. Please let me know how I can do this.

 

I used the myDAQ and connect to ELVIS. It works perfectly. But I would like to be able to do this on the DAQmx.

 

Sincerely,

Hoang

 

 

Download All
0 Kudos
Message 1 of 7
(5,236 Views)

Hoang,

 

It is very diifficult to tell what is going on without any data.  Please run your VI until you have some data shown on the data graph. Stop the VI. Edit >> Make Current Values Default. Save. Then post that VI.

 

Also, please tell us the values of the components in the circuit and the signal parameters you are using to excite the circuit (frequencies, waveform, amplitude).

 

I suspect that one problem is that you are only acquiring 100 samples on each iteration.  That is only 0.2 ms of data which is the time for one cycle at 5 kHz.  The analysis VIs you have use FFT methods internally. The FFT typically does not work well unless it has >3-5 cycles of the signal and fractions of a cycle can be a problem with short data sets.  This suggests that your VI may only work for signals in the 25-250 kHz range.  My guess is that the capacitor is large enough that signals in that range are severely attenuated.

 

Lynn

0 Kudos
Message 2 of 7
(5,214 Views)

Thank you Lynn for the reply.

 

I have attached the vi with data. I get a really weird frequency response graph. But when I use the bode analyzer using the other myDAQ, it came out fine. I've also attached it.

 

The output frequency from the function generator is 1k Hz. The Voltage peak to peak is 100.0 mili volt.

 

The two resistors are both 1k Ohm each and the capacitor is 2.2 micro Farad.

 

Thank you,

Hoang

Download All
0 Kudos
Message 3 of 7
(5,201 Views)

I do not know what those Express VIs are doing but your signal is OK.

 

I converted the evil Dynamic Data Type to a waveform and then looked at the spectrum. Other than the low resolution due to the small data set, the spectrum has a large peak at 1 kHz.

 

I supsect that the FRF is not happy that only one frequency is present in the signal.  It is hard to generate a Bode plot from one data point.

 

Lynn

0 Kudos
Message 4 of 7
(5,176 Views)

Thank you Lynn. I will try looking further into it. I really appreciate your help!

 

Hoang

0 Kudos
Message 5 of 7
(5,171 Views)

Not sure whether I did this correctly or not. I make sure to manually pick out the two signals and feed into the FRF. It wouldn't returna nice bode plot. (attached)

 

I notice that the x-axis is displying time rather than frequency. Could this be the reason why it's not working correctly? Do you know how to change it to frequency?

 

Thank you very much!

Hoang

0 Kudos
Message 6 of 7
(5,145 Views)

The Split Signal node already does that.

 

The scale labels are just text. They do not change automatically when wiring a different kind of signal to them. Just select "Time" with the text tool and type "Frequency" in its place.  You can do the same for Phase on the vertical axis.

 

I looked at your signals again by doing a spectral analysis on each of them. At 1 kHz the input signal is about 20 dB greater than the output signal. Over almost all of the rest of the spectrum both signals are about 90 dB down. The effect on FRF is similar to dividing (almost) zero by (almost) zero: the result is meaningless.  You need to make repeated measurements at different frequencies or use an excitation signal which has a wide frequency content.

 

Lynn

Message 7 of 7
(5,139 Views)