Instantaneous frequency for EEG

I would like to calculate inst. frequency for eeg signal. I find your code at brainstorm-tools/brainstorm3, but when I run it in matlab deal with Error in process_tf_instfreq (line 26)
eval(macro_method) :Argument must contain a character vector or function_handle., how can I fix it?

Hi,

This process can be accessed in the Pipeline editor under Frequency -> Instantaneous frequency [Experimental]. It requires one or more time frequency files. In order to use a process in a script, refer to the following tutorial page: http://neuroimage.usc.edu/brainstorm/Tutorials/Scripting

If you're adamant in calling the function directly, usually you should refer to its described usage in the function header:

TimefreqMat = process_tf_instfreq('Compute', TimefreqMat, FreqBands, TimeBands)

Although it seems it is incorrect in this case, the correct usage would be:

TimefreqMat = process_tf_instfreq('Compute', TimeBands, TimefreqMat, IfMethod, auger_ml_L_parameter)

Where the 2 last arguments are optional and will default to 'baillet' and 2 respectively. I'm afraid it seems we do not have a tutorial page explaining this specific process as it is still experimental. Refer to the Compute function in process_tf_instfreq.m for a reference of each IfMethod in the comments.

1 Like

Hi,
Thank you for reply.
I don`t understand well, when I call varargout = process_tf_instfreq(signal) the error is appear, why this calling is wrong? I have a analytical eeg signal decomposed to its frequency bands and I want to calculate IF for each band. How can I use this program for this issue and which function should I call? I don’t understand the concept of TimefreqMat,TimeBands,…, I have to acquire them in my signal??

Thank you
Saeideh

Hi Saeideh,

You’re getting an error because the function was not coded to support a single argument. Rather, it assumes multiple arguments, which I listed above. It should be easy for you to extract the 2 necessary arguments from your signal.

  • TimefreqMat should be a matrix of dimensions numChannels x numSamples x numFreqBands containing your signal.
  • TimeBands should be a vector containing the time at each sample (1 x numSamples). If your sample rate is constant, then [0, 1/sampleRate, 2/sampleRate, …, (numSamples-1)/sampleRate].

However, maybe the easiest way for you would be to import your EEG data in the program and then call the Instantaneous frequency process from the GUI. We support most popular formats and even simply importing a Matlab matrix. Here is our EEG tutorial: http://neuroimage.usc.edu/brainstorm/Tutorials/Epilepsy

Cheers,
Martin

Thank you Martin,
I realized when I import my signal to matlab I can call TimefreqMat = process_tf_instfreq('Compute', TimefreqMat, FreqBands, TimeBands)
For extracting TimeFreqMat as you mentioned (TimefreqMat should be a matrix of dimensions numChannels x numSamples x numFreqBands containing your signal) seems I will have a two-dimension matrix, suppose that the signal contains 14 channels number of samples is 640 and number of freqband is 5, so you mean we have a matrix 146405 ?

Thanks
Saeideh

@Sylvain Is this process reliable?
I have never used it myself, a short tutorial would be good.

That is correct.

Cheers,
Martin