Hello all~
I have a question about MEX files document in BCI2000 wiki
in the function of mem.
[spectrum, frequencies] = mem(signal, parms);
I don't know how is the form of input parms.
I have tried many forms of parms but error massage is occurred.
for example,
parms = [parameters.ModelOrder.NumericValue, parameters.FirstBinCenter.NumericValue,parameters.LastBinCenter.NumericValue,parameters.BinWidth.NumericValue,parameters.EvaluationsPerBin.NumericValue];
[spectrum, frequency]=mem(signal, parms);
error message is this
??? Error using ==> mem
Expected real double input signal  The mem command estimates a power spectrum
using Burg's MEM algorithm.
The calling syntax is:
[spectrum, frequencies] = mem(signal, parms)
with <signal> and <spectrum> having dimensions values x channels, and
with <parms> being a vector of parameter values:
model order,
first bin center,
last bin center,
bin width,
evaluations per bin,
detrend option (optional, 0: none, 1: mean, 2: linear; defaults to none),
frequency (optional, defaults to 1)
Error in ==> test at 26[spectrum, frequency]=mem(signal, parms);
please give me a reply
thank you
Young Hak Shin
MEX files
It is hard to tell what is happening, but it appears the signal might not be in the matlab "double" format. You can try this:
or this:
and it might work.
Adam
Code: Select all
signal = double(signal);
[spectrum, frequencies] = mem(signal, parms);
Code: Select all
[spectrum, frequencies] = mem(double(signal), parms);
Adam

 Posts: 10
 Joined: 06 Jul 2010, 09:00
Thank you for your response
As your mention, i tried like below
parms=[20, 0, 30, 3, 15];
[spectrum, frequency]=mem(double(signal), parms);
but i have another error message
??? Error using ==> mem
Bin width must be between 0 and half the sampling rate.
Error in ==> test at 26
[spectrum, frequency]=mem(double(signal), parms);
I set the BinWidth to 3. and sampling rate is 256, block size is 32.
This BinWidth is between 0 and half the sampling rate.
I don't know what is the problem.
please help me
Thank you
Shin Young Hak
As your mention, i tried like below
parms=[20, 0, 30, 3, 15];
[spectrum, frequency]=mem(double(signal), parms);
but i have another error message
??? Error using ==> mem
Bin width must be between 0 and half the sampling rate.
Error in ==> test at 26
[spectrum, frequency]=mem(double(signal), parms);
I set the BinWidth to 3. and sampling rate is 256, block size is 32.
This BinWidth is between 0 and half the sampling rate.
I don't know what is the problem.
please help me
Thank you
Shin Young Hak
Ok, I see the problem. You need to pass the Frequency parameter, which is optional. If you do not pass it, then it defaults to 1, and all of your values would then need to be scaled accordingly, e.g., 0.0 <= BinWidth < 0.5, and so on. This parameter lets the program know what the sample rate is. So, you could use:
I added the "1" so that the mean is removed from the signal (you can also try 2), and then the sampling rate.
This should work...
Code: Select all
parms = [parameters.ModelOrder.NumericValue, parameters.FirstBinCenter.NumericValue, parameters.LastBinCenter.NumericValue, parameters.BinWidth.NumericValue, parameters.EvaluationsPerBin.NumericValue, 1, parameters.SamplingRate.NumericValue];
This should work...
Who is online
Users browsing this forum: No registered users and 3 guests