Matlab question - Computing induced power

Hi Mike, Hi all,

Hope you’re doing fine and healthy.

I wonder if I could get some help from the Matlab-savvy from the group.
I’m trying to compute the induced power for some data. I computed the power for a set of trials for a given condition and for each subject, and I computed the ERP also for each condition and subject. I’m trying to figure out how to subtract the ERP from the single trials.

My matrices are:
[64 35] channels x time for the ERP and
[225 64 20 35] trials x channels x frequencies x time for the allTrials matrix.

My guess is that I could use some repmat somewhere to make the trick, but I’m a bit overwhelmed with the dimensions (it’s only 4 but still :confused: ). Also, I’m not sure how to deal with the frequency dimension between the channels and time dimension.

Has anybody done this and could give me a hand?
Any hint will be appreciated!

best,
Jose

Hey Jose. The induced power is computed from the single-trial residual of the EEG data after subtracting the ERP. So you don’t need to deal with a 4D TF matrix; instead, you first compute the time-domain induced response, and then take its TF decomposition.

It would be something like:
EEG.nonphaselocked = EEG.data - mean(EEG.data,3);

Notice I’m not over-writing EEG.data. Then you run the standard TF analysis on EEG.nonphaselocked (and also on EEG.data if you want to compare them).

Also keep in mind that if you have different conditions, you should subtract the ERP separately per condition. But I hope the code above will get you started :slight_smile:

1 Like

Thanks Mike! This get me started indeed!