Home My Page Projects MPTK: The Matching Pursuit ToolKit
 Summary Activity Forums Tracker Lists Docs News SCM Files

# Forum: help Monitor Forum | Start New Thread
 Nested Flat Threaded Ultimate Show 25 Show 50 Show 75 Show 100
 MPTK anywave questions [ Reply ]By: Roilhi Ibarra on 2016-03-18 20:26 [forum:150394] I'm trying to implement waveforms in the anywave dictionary, I already have read the user and developer manuals to know how it blocks works. However, I'm having some trouble while creating the raw data in .bin format, first, I tried to create the binary of two sinusoids in MATLAB using this code: % Generate two sinusoidal waves, each one with 128 samples, the frequency of % each one is doubled, i.e. f2 = 2f1. Then, save these sinusoids in .bin % format to be applied in MPTK as an anywave dictionary. % clear close all clc N = 126; % Number of samples fs = 8000; % Sampling frequency f0 = 80; % f1 = 160; sig1 = sin((0:N+1)/fs*2*pi*f0); sig2 = sin((0:N+1)/fs*2*pi*f1); A = [sig1; sig2]; fid = fopen('twoSinusoids.bin','w'); fwrite(fid,A,'double'); fclose(fid); I also created the SinusoidsTable.xml file for the anywavetable as follows: 0.6.0 Then, I made the anywaveSinusoids.xml for the dictionary: 0.5.4 Is this the right way to create the .bin file? I tried to recovered the sinusoids by applying MP with this dictionary and a delta function without success with the following code in MATLAB: fs = 8000; dict = dictread('/usr/local/mptk/reference/dictionary/anywaveSinusoids.xml'); sig = zeros(8000,1); sig(4000) =1; numIter = 1; [book, residual , decay] = mpdecomp(sig,fs, dict, numIter); sigrec = mprecons(book,dict);