LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT of waveform (lvm file converted from mat file) - how do I overcome dt error <=0?

Solved!
Go to solution

Hi,

 

I am using an lvm file after conversion from mat file. I wanted to get the fft  spectrum.I keep getting this error that waveform dt<=0.

How do I overcome it?

 

I have attached the mat file and the vi i used.

 

Best regards,

 

Fesmi

0 Kudos
Message 1 of 8
(4,988 Views)

Your VI uses subVIs from an addon or toolkit I do not have. And you have not attached the Matlab file.

 

From looking at what little I can see of the block diagram my guess is that the data file either does not contain timing information or the Read Data VI does not interpret it correctly. The evil Dynamic Data Type obscures information about the data structures inside so there is no way to tell without the complete VI and subVIs what is in there.

 

Lynn

0 Kudos
Message 3 of 8
(4,947 Views)

@johnsold wrote:

The evil Dynamic Data Type obscures information about the data structures inside


Yes!

 

0 Kudos
Message 4 of 8
(4,940 Views)

Hi,

 

Thanks a lot for your replies.

 

Probably the vi wasnt opened correctly because it contained MATLab data plugin ??

The only additional toolkit I have used is the 'System Identification' tool kit.

I am also attaching the .mat file with this post.

 

But since I see no choice but to live with this data, kindly advice how to overcome this 'evil' Dynamic data type!..

🙂

 

 

 

0 Kudos
Message 5 of 8
(4,919 Views)

PS: I have attache the excel file of the data , as the post doesn't seem to accept my .mat or .lvm files!!

 

0 Kudos
Message 6 of 8
(4,917 Views)
Solution
Accepted by topic author fesmi

The Forum is somewhat particular about the files which may be attached. Often creating a zip file works. Sometimes you can change the extension to .txt. If you change the extension, please indicate in your post what the orignal extension was.

 

It appears that the data in the file has a time column and an amplitude column. The LabVIEW waveform datatype is a cluster of an array of amplitudes (Y), sampling interval (dt), starting time (t0), and optional attributes. This is what the Power Spectrum VI requires as an input. The t0 values is not used so the defualt is fine. the dt value can be calculated from the difference of any two adjacent values in the time column. Since the first value is zero, the second value is equal to dt.  Use the Build Waveform primitive from the Waveform palette.  Expand it to show the dt element.

 

In the attached VI all rows is an indicator which contains the data from your file saved as default. XY Graph plots that data.  After subtracting the mean to get rid of a DC component, the data is converted to a waveform. The power spectrum is calculated and displayed using the same VI as in your program. It also uses Extract Multiple Tone Information.vi to get the frequency and amplitude of the major peaks in the data.

 

Interestingly the low frequency part of the spectrum has strong harmonics of 60 Hz while the peaks near 4 kHz are space ~100 Hz apart.  The broad peak near 2.1 kHz does not seem to have noticeable components at either 60 or 100 Hz.

 

How do you avoid the Dynamic Data Type (DDT)? Stop using Express VIs! For reasons only known to NI, Express VIs deliver their outputs via DDT. Except by opening the block diagram of the express VI, there is no way to tell what the underlying data structure on a DDT wire is. 

 

Lynn

0 Kudos
Message 7 of 8
(4,892 Views)

Hi,

 

Thanks  a lot for the suggestion and the example vi.

 

I have now altered my vi and used the 'build waveform' unit to acquire the data from the lvm file.

It now reads the data well and i am getting the graphs,. alhamdulillah.

 

Best regards,

 

fesmi

 

 

0 Kudos
Message 8 of 8
(4,873 Views)