LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coherence Function between 2 Signals using Dual Channel Spectral Measurement

Hello,
 
I have acquired two signals, with a USB 9215A data acquisition board.
The signals have 131072 samples each and the sampling frequency was 20kHz, the sampling period was 1/20kHz = 0.00005 seconds. (They are attached).
 
I was trying to calculate the Coherence Function between the two signals. My problem is that I get the error which is presented in the image.
 
As i understand, for a Signal, the dt parameter indicates the sampling period. The error states that the dt for my signals is <=0.
 
How can I fix this????  Is there something wrong with my calculation??
 
 
 
Download All
0 Kudos
Message 1 of 12
(10,288 Views)

Hi Raul,

I noticed that the files you have attached are .txt files, but the Read/Write Measurement File VIs use lvm, tdm, or tdms file formats. I actually tried with your .txt files and couldn’t get anything to run. However, I changed the file extensions to .lvm and then your exact program ran fine for me. I only added explicit error handling. I wonder if it’s the settings you’re using with the express VIs. I’ve included screenshots from what I was able to get to run. Let me know if you have further issues with setting this up and tell me a little more about your application as a whole, including what version of LabVIEW, etc. you’re using.

Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 2 of 12
(10,271 Views)
Hello and Thank you for your help.
I've managed to calculate the Coherence Function by using the Frequency Response Function(Mag-Phase).vi
My Application deals with several pairs of signals, from a certain noise source (water comming out of a broken pipe).
I'm trying to determine which is the frequency domain, most suitable for analysing the signals.
 
I've attached my vi, maybe someone else wants to use it.
I.ve double checked my results with the cohere function, from Matlab. They are ok.
 
Have a nice day.
0 Kudos
Message 3 of 12
(10,254 Views)
What you are seeing is expected.  The dynamic data type is an array of waveform data types under the hood.  A waveform data type has three components, an initial time t0, the interval between the data points, dt, and the actual data array itself.  Your data files contain only the data array, so the t0 and dt values are set to zero; this causes your problem.  Another fix, which gives you a bit more control, is to convert your dynamic data wires to waveform wires (use Convert from Dynamic Data in the signal manipulation subpalette of Express), then explicitly set the dt value using Build Waveform from the waveform palette.  Convert back to dynamic data using Convert to Dynamic Data.
0 Kudos
Message 4 of 12
(10,248 Views)

I always got 1 of coherence values when I simulate two signals (added noise as well) and use dual channel spectral measurement. What's wrong?

0 Kudos
Message 5 of 12
(8,740 Views)

Hello,

 

I am using Labview 2009 and I have had problems with coherence calculations. Instruments which worked with Labview 8.5 and provided good coherence calculations do not work with Labview 2009 (Ex. Frequency Response (Mag and Phase)). I have tried to calculate the coherence between two different signals using: the 

coherence (MathScript RT Module Function) - did not work, not evet the example presented in the Labview help.

dual channel spectral measurement- coherence was 1 over all frequency values, which is was ok.

frequency response function (mag-phase) - coherence was 1 over all frequency values, which is was ok.

 

A possible solution:

Calculate the Magnitude Squared Coherence. The results are similar because it is based on the calculations of the power spectrum and cross power spectrum. I have attached photos with my calculations. Hope this helps.

Download All
0 Kudos
Message 6 of 12
(8,722 Views)
can u post the code of coherence function?
0 Kudos
Message 7 of 12
(8,608 Views)

Look at the previous message. The block diagram and front panel are presented as jpg files.

0 Kudos
Message 8 of 12
(8,603 Views)

Hi Raul,

 

could you please provide/attach the vi file for the coherence calculation? I'm new to labview and I sometimes can't find the modules even if I see them in you jpeg 😞

 

thanks a lot !

 

daqboy

0 Kudos
Message 9 of 12
(8,472 Views)

Hello,

 

Ok, sorry for the delay, I've been out of town.

 

Have a nice day.

0 Kudos
Message 10 of 12
(8,429 Views)