MPTK 0.5.8: MATLAB utility readbook()

Once I have successfully decomposed a signal, it is time to work with the data in MATLAB. After compiling the function readbook using mex, I can do the following in MATLAB:

book = bookread(‘testdecomp.bin’);

This gives me the structure

>> book

book =

format: ‘0.1’
numAtoms: 4543
numChans: 1
numSamples: 176400
sampleRate: 44100
index: [5×4543 double]
atom: [1×9 struct]

Most of these items are self-explanatory, but what of the last two?

>> book.index(:,1:5)

ans =

           1           2           3           4           5
           3           6           6           6           6
           1           1           2           3           4
           1           1           1           1           1
           0           0           0           0       16384

What does this mean? Digging around the code in “mxBook.cpp”, I see that each row is as follows:

1. MP decomposition iteration
2. atom type index (into the structure book.atom)
3. atom index (into the structure of the structure book.atom)
4. number of atoms selected (1 always in this case since it is not a stereo signal)
5. time position of this atom

So, for the first iteration of the above data we have an atom of the 3rd type, the structure of which we can get by

>> book.atom(3)

ans =

type: ‘gabor’
params: [1×1 struct]

The parameters of all the atoms of this type are given by

>> book.atom(3).params

ans =

amp: [894×1 double]
chirp: [894×1 double]
freq: [894×1 double]
len: [894×1 double]
phase: [894×1 double]
pos: [894×1 double]
windowoption: [894×1 double]
windowtype: [894×1 double]

And thus, the first element of these row vectors are the parameters for this first atom found by MP, the frequency of which is

>> book.atom(3).params.freq(1)

ans =


where 0.5 is the Nyquist frequency.  Et voilà, nous avons raison en MATLAB.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s