LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mathscript node problem - specgram function of matlab

Hello...
I used to use "specgram" function of matlab, in a M file builded to perform FFT spectral analysis in signals. I am trying to build a VI to perform the same action.

In a blank VI I created a Mathscript node and pasted the code of my M file inside it. After adjust the input and outputs of the node, I run the VI and received the Error message "Unknown symbol on line 7 : specgram"

How do I solve this issue? How do I execute the specgram inside the mathscript node?

Thank you in advance

Dan07
0 Kudos
Message 1 of 5
(3,747 Views)

Hello dan07,

Could you post here the code you are using in Mathscript node?

Regards,

Luciano Borges

National Instruments Brazil

Luciano Borges
Test Development Engineer
0 Kudos
Message 2 of 5
(3,728 Views)
Hello,

The specgram function is not currently present in LabVIEW MathScript.  You may be able to get what you need from using a LabVIEW VI.  Try searching the LabVIEW help for "spectrogram."  You should see an entry for "STFT Spectrograms."  This VI may perform the analysis you need.  As for MathScript, this function was present in the open beta of 8.6, so it may be available once 8.6 releases.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 3 of 5
(3,709 Views)
Hello Luciano...


-    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 text

-    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);

-    Short Time Fourier Transformation was performed in each segment, using the specgram function of Matlab;


-    This operation resulted in 5 ascii files:

o   B: ascii file with 34 columns, each column represent one segment and has the values that build the spectrum of the segment - signal 1
o   C: ascii file with 34 columns, each column represent one segment and has the values that build the spectrum of the segment - signal 2
o   pi: ascii file with one column with 9001 interpolated values - signal 1
o   fi: ascii file with one column with 9001 interpolated values - signal 2
o   X: ascii file with 4 columns and 34 lines (one line for each segment), with mean and SD values for signals 1 and 2

I have already build a VI that generates the interpolated series of values and splits it as well, but using spectrogram function in labview I didn't get the same results (values) of specgram (matlab).

Thanks in advance

Dan07
0 Kudos
Message 4 of 5
(3,686 Views)
Hello Luciano...

I am a beginner user of Matlab and Labview, but let me know if I can provide you any additional information about my analysis, to help you to help me Smiley Happy

The macro was used in Matlab 5.3 (educacional version) and provides correct values about my signal analysis.

Thanks in advance

Dan07
0 Kudos
Message 5 of 5
(3,676 Views)