Hello...
I need to perform the same operation (spectral analysis of signals) that I used to perform using a Matlab macro, but now I need to do using Labview. My Matlab macro has the following steps:
- First of all I use the “load” command to open an ASCII file into Matlab;
- The ASCII file has 3 columns:
o Column 1: Time Series
o Column 2: 900 seconds of Signal 1
o Column 3: 900 seconds of Signal 2
- “After this point, all the operations were performed in the same way to both signals, I will in the next steps talk about only one signal to produce a short question”
- The Signal was interpolated by cubic spline interpolation using 10 Hz (one point each 100 ms);
- The new sequence of values of the signal has 9001 values;
- This new series was splitted into 34 segments of 512 points each, overlapped by 50 % (256 points);
- Fast Fourier Transformation was performed in each segment, using the specgram function of Matlab;
- This operation resulted in a ASCII file with 34 columns (one column for each segment), with the values generated by FFT; The macro operation ends here. It generates also files with the interpolated values and some mean calculations but is not important to the present issue, they are used just to archive the results;
- From this point the operations were “hand made”
- The spectra were considered in three frequency bands:
o Very Low Frequency (VLF): 0 – 0.2 Hz
o Low Frequency (LF): 0.2 – 0.75 Hz
o High Frequency (LF): 0.75 – 3 Hz
- Using a frequency column as reference, I was able to know that from line X until line Y are the FFT generated values related to VLF, from line Y until Z related to LF.......
- This reference column goes from 0 until 5 Hz, stepped by 0.01953125. Because I used 512 points and a resample frequency of 10 Hz, 10/512=0.01953125
- The integral of the values related to VLF, LF and HF was calculated for each column, resulting in 34 values of VLF, 34 values of LF and 34 values of HF;
- Next, I performed the average of these 34 values of VLF, LF and HF and got a representative number for VLF, LF and HF.
I need to perform the same operation using Labview. I builded a VI that:
- Load the 3 columns file;
- Split this file in three different columns;
- Perform the spline interpolation for each signal, generating a large series of values;
- Splits the series into 34 segments of 512 points each, overlapped by 50 % (256 points);
- By means of STFT Spectrograms VI, I performed the espectral analysis of each segment;
- Using boundaires I separated the VLF, LF and HF values and performed the numeric integration of them;
- Next, the VI performs the calculation of the mean of the 34 values of VLF, 34 values of LF and 34 values of HF.
The main problem is, the results obtained using specgram function of matlab are not the same values obtained with my VI, what is wrong?
I have also tried some other Vis, like FFT, Power and Spectral measurements, but without success.
The split of series in 34 segments is importat because it allow me to exclude some value that is out of normal range. In the VI attached this step was removed to provide a clean VI.
Attached is:
My VI
One ASCII file with a example data (3 columns)
One 34 columns ASCII file obtained after FFT by matlab, for signal 1
One 34 columns ASCII file obtained after FFT by matlab, for signal 2
The Matlab macro
Thanks in advance for any kind of help
Daniel