Permalink
Browse files

Always use [0:dt:dur] rather than linspace to create time arrays.

Add CHANGES file.
Regenerate demo docs.
  • Loading branch information...
1 parent 52a3904 commit e24e4c964e4c6cc5ae96c953e758bd3fd8d0fc4d @lebedov lebedov committed Oct 27, 2009
View
@@ -0,0 +1,12 @@
+Release 0.02 - (October 26, 2009)
+=================================
+* Add ASDM population decoding algorithms.
+* Make time array construction consistently use a fixed time step.
+
+Release 0.011 - (May 08, 2009)
+==============================
+* Change package name to Time Encoding and Decoding Toolbox.
+
+Release 0.01 - (May 08, 2009)
+=============================
+* First public release.
View
@@ -1,5 +1,5 @@
% Time Encoding and Decoding Toolbox
-% Version 0.011
+% Version 0.02
%
% Asynchronous Sigma-Delta Modulator Functions
% asdm_decode - ASDM time decoding machine.
View
@@ -19,8 +19,7 @@
tsh = (ts(1:end-1)+ts(2:end))/2;
nsh = length(tsh);
-nt = floor(dur/dt);
-t = linspace(0,dur,nt);
+t = [0:dt:dur];
bwpi = bw/pi;
@@ -39,7 +38,7 @@
% Reconstruct signal by adding up the weighted sinc functions. The
% weighted sinc functions are computed on the fly here to save memory:
-u_rec = zeros(1,nt);
+u_rec = zeros(1,length(t));
c = G_inv*q;
for i=1:nsh,
u_rec = u_rec + sinc(bwpi*(t-tsh(i)))*bwpi*c(i);
@@ -21,8 +21,7 @@
tsh = (ts(1:end-1)+ts(2:end))/2;
nsh = length(tsh);
-nt = floor(dur/dt);
-t = linspace(0,dur,nt);
+t = [0:dt:dur];
jbwM = j*bw/M;
@@ -22,8 +22,7 @@
ts = cumsum(s);
tsh = (ts(1:end-1)+ts(2:end))/2;
-nt = floor(dur/dt);
-t = linspace(0,dur,nt);
+t = [0:dt:dur];
nsh = length(tsh);
bwpi = bw/pi;
@@ -44,7 +43,7 @@
% Reconstruct signal by adding up the weighted sinc functions; the
% first row of B is removed to eliminate boundary issues. The
% weighted sinc functions are computed on the fly here to save memory:
-u_rec = zeros(1,nt);
+u_rec = zeros(1,length(t));
c = pinv(B(2:end,:)*G)*Bq(2:end);
for i=1:nsh,
u_rec = u_rec + sinc(bwpi*(t-tsh(i)))*bwpi*c(i);
@@ -66,9 +66,8 @@
c = pinv(G)*q;
% Reconstruct the signal using the coefficients:
-Nt = floor(dur/dt);
-t = linspace(0,dur,Nt);
-u_rec = zeros(1,Nt);
+t = [0:dt:dur];
+u_rec = zeros(1,length(t));
for m=1:M,
for k=1:Nsh_list(m),
u_rec = u_rec + sinc(bwpi*(t-tsh_list{m}(k)))*bwpi* ...
@@ -65,9 +65,8 @@
c = pinv(G)*Bq;
% Reconstruct the signal using the coefficients:
-Nt = floor(dur/dt);
-t = linspace(0,dur,Nt);
-u_rec = zeros(1,Nt);
+t = [0:dt:dur];
+u_rec = zeros(1,length(t));
for m=1:M,
for k=1:Nsh_list(m),
u_rec = u_rec + sinc(bwpi*(t-tsh_list{m}(k)))*bwpi* ...
View
@@ -37,8 +37,7 @@
tsh = (ts(1:end-1)+ts(2:end))/2;
nsh = length(tsh);
-nt = floor(dur/dt);
-t = linspace(0,dur,nt);
+t = [0:dt:dur];
bwpi = bw/pi;
RC = R*C;
@@ -65,7 +64,7 @@
G_inv = pinv(G);
% Reconstruct signal by adding up the weighted sinc functions:
-u_rec = zeros(1,nt);
+u_rec = zeros(1,length(t));
c = G_inv*q;
for i=1:nsh,
u_rec = u_rec + sinc(bwpi*(t-tsh(i)))*bwpi*c(i);
@@ -38,8 +38,7 @@
tsh = (ts(1:end-1)+ts(2:end))/2;
nsh = length(tsh);
-nt = floor(dur/dt);
-t = linspace(0,dur,nt);
+t = [0:dt:dur];
RC = R*C;
jbwM = j*bw/M;
@@ -10,7 +10,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
@@ -10,7 +10,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
@@ -11,7 +11,7 @@
-->
<title>Time Encoding and Decoding with an Asynchronous Sigma-Delta Modulator</title>
<meta name="generator" content="MATLAB 7.7">
- <meta name="date" content="2009-05-01">
+ <meta name="date" content="2009-10-26">
<meta name="m-file" content="asdm_demo"><style type="text/css">
body {
@@ -89,7 +89,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
@@ -103,7 +103,7 @@
u = func_timer(@gen_test_signal,dur,dt,f,np);
plot_signal(t,u,fig_title);
</pre><pre class="codeoutput">ASDM input signal with no noise
-execution time = 0.051 s
+execution time = 0.117 s
</pre><img vspace="5" hspace="5" src="asdm_demo_01.png" alt=""> <h2>Time Encoding<a name="2"></a></h2>
<p>The encoding parameters are validated to ensure that signal recovery will be possible:</p><pre class="codeinput">b = 3.5; <span class="comment">% bias</span>
d = 0.7; <span class="comment">% threshold</span>
@@ -118,28 +118,28 @@
s = func_timer(@asdm_encode,u,dt,b,d,k);
plot_encoded(t,u,s,fig_title);
</pre><pre class="codeoutput">encoding using nonleaky ASDM algorithm
-execution time = 0.561 s
+execution time = 0.493 s
</pre><img vspace="5" hspace="5" src="asdm_demo_02.png" alt=""> <h2>Time Decoding<a name="3"></a></h2>
<p>The encoded signal can be recovered using one of several different decoding algorithms:</p><pre class="codeinput">fig_title = <span class="string">'decoding using ASDM algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@asdm_decode,s,dur,dt,bw,b,d,k);
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using ASDM algorithm
-execution time = 0.456 s
+execution time = 0.492 s
</pre><img vspace="5" hspace="5" src="asdm_demo_03.png" alt=""> <pre class="codeinput">fig_title = <span class="string">'decoding using threshold-insensitive ASDM algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@asdm_decode_ins,s,dur,dt,bw,b);
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using threshold-insensitive ASDM algorithm
-execution time = 0.438 s
+execution time = 0.341 s
</pre><img vspace="5" hspace="5" src="asdm_demo_04.png" alt=""> <pre class="codeinput">M = 5; <span class="comment">% fast decoding parameter</span>
fig_title = <span class="string">'decoding using fast ASDM algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@asdm_decode_fast,s,dur,dt,bw,M,b,d,k);
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using fast ASDM algorithm
-execution time = 0.228 s
+execution time = 0.182 s
</pre><img vspace="5" hspace="5" src="asdm_demo_05.png" alt=""> <p class="footer"><br>
Published with MATLAB&reg; 7.7<br></p>
</div>
@@ -157,7 +157,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -11,7 +11,7 @@
-->
<title>Time Encoding and Decoding with Multiple Asynchronous Sigma-Delta Modulators</title>
<meta name="generator" content="MATLAB 7.7">
- <meta name="date" content="2009-06-23">
+ <meta name="date" content="2009-10-26">
<meta name="m-file" content="asdm_pop_demo"><style type="text/css">
body {
@@ -89,7 +89,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
@@ -103,7 +103,7 @@
u = func_timer(@gen_test_signal,dur,dt,f,np);
plot_signal(t,u,fig_title);
</pre><pre class="codeoutput">ASDM input signal with no noise
-execution time = 0.029 s
+execution time = 0.070 s
</pre><img vspace="5" hspace="5" src="asdm_pop_demo_01.png" alt=""> <h2>Time Encoding<a name="2"></a></h2>
<p>In this example, the input signal is encoded using two ASD modulators with different encoding parameters. The parameters are
validated to ensure that signal recovery will be possible:
@@ -120,7 +120,7 @@
s1 = func_timer(@asdm_encode,u,dt,b1,d1,k1);
plot_encoded(t,u,s1,fig_title);
</pre><pre class="codeoutput">encoding using ASDM algorithm (encoder #1)
-execution time = 0.330 s
+execution time = 0.324 s
</pre><img vspace="5" hspace="5" src="asdm_pop_demo_02.png" alt=""> <pre class="codeinput">b2 = 3.6; <span class="comment">% bias</span>
d2 = 0.5; <span class="comment">% threshold</span>
k2 = 0.01; <span class="comment">% scaling factor</span>
@@ -134,21 +134,21 @@
s2 = func_timer(@asdm_encode,u,dt,b2,d2,k2);
plot_encoded(t,u,s2,fig_title);
</pre><pre class="codeoutput">encoding using ASDM algorithm (encoder #2)
-execution time = 0.326 s
+execution time = 0.304 s
</pre><img vspace="5" hspace="5" src="asdm_pop_demo_03.png" alt=""> <h2>Time Decoding<a name="4"></a></h2>
<p>The encoded signals can be recovered using a population decoding algorithm:</p><pre class="codeinput">fig_title = <span class="string">'decoding using ASDM population algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@asdm_decode_pop,{s1,s2},dur,dt,bw, <span class="keyword">...</span>
{b1,b2},{d1,d2},{k1,k2});
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using ASDM population algorithm
-execution time = 1.043 s
+execution time = 1.233 s
</pre><img vspace="5" hspace="5" src="asdm_pop_demo_04.png" alt=""> <pre class="codeinput">fig_title = <span class="string">'decoding using threshold-insensitive ASDM population algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@asdm_decode_pop_ins,{s1,s2},dur,dt,bw,{b1,b2});
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using threshold-insensitive ASDM population algorithm
-execution time = 1.000 s
+execution time = 1.159 s
</pre><img vspace="5" hspace="5" src="asdm_pop_demo_05.png" alt=""> <p class="footer"><br>
Published with MATLAB&reg; 7.7<br></p>
</div>
@@ -166,7 +166,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -11,7 +11,7 @@
-->
<title>Time Encoding and Decoding with an Integrate-and-Fire Neuron</title>
<meta name="generator" content="MATLAB 7.7">
- <meta name="date" content="2009-05-01">
+ <meta name="date" content="2009-10-26">
<meta name="m-file" content="iaf_demo"><style type="text/css">
body {
@@ -90,7 +90,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
@@ -104,7 +104,7 @@
u = func_timer(@gen_test_signal,dur,dt,f,np);
plot_signal(t,u,fig_title);
</pre><pre class="codeoutput">IAF input signal with no noise
-execution time = 0.050 s
+execution time = 0.071 s
</pre><img vspace="5" hspace="5" src="iaf_demo_01.png" alt=""> <h2>Time Encoding<a name="2"></a></h2>
<p>The encoding parameters are validated to ensure that signal recovery will possible:</p><pre class="codeinput">b = 3.5; <span class="comment">% bias</span>
d = 0.7; <span class="comment">% threshold</span>
@@ -120,22 +120,22 @@
s = func_timer(@iaf_encode,u,dt,b,d,R,C);
plot_encoded(t,u,s,fig_title);
</pre><pre class="codeoutput">encoding using leaky IAF algorithm
-execution time = 0.597 s
+execution time = 0.349 s
</pre><img vspace="5" hspace="5" src="iaf_demo_02.png" alt=""> <h2>Time Decoding<a name="3"></a></h2>
<p>The encoded signal can be recovered using one of several different decoding algorithms:</p><pre class="codeinput">fig_title = <span class="string">'decoding using leaky IAF algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@iaf_decode,s,dur,dt,bw,b,d,R,C);
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using leaky IAF algorithm
-execution time = 2.158 s
+execution time = 1.280 s
</pre><img vspace="5" hspace="5" src="iaf_demo_03.png" alt=""> <pre class="codeinput">M = 5; <span class="comment">% fast decoding parameter</span>
fig_title = <span class="string">'decoding using leaky fast IAF algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@iaf_decode_fast,s,dur,dt,bw,M,b,d,R,C);
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using leaky fast IAF algorithm
-execution time = 0.182 s
+execution time = 0.279 s
</pre><img vspace="5" hspace="5" src="iaf_demo_04.png" alt=""> <h2>Non-leaky Neuron Model<a name="6"></a></h2>
<p>Setting the neuron's resistance to infinity is equivalent to using a non-leaky neuron model for encoding and decoding the
signal:
@@ -146,21 +146,21 @@
s = func_timer(@iaf_encode,u,dt,b,d,R,C);
plot_encoded(t,u,s,fig_title);
</pre><pre class="codeoutput">encoding using nonleaky IAF algorithm
-execution time = 0.546 s
+execution time = 0.289 s
</pre><img vspace="5" hspace="5" src="iaf_demo_05.png" alt=""> <pre class="codeinput">fig_title = <span class="string">'decoding using nonleaky IAF algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@iaf_decode,s,dur,dt,bw,b,d,R,C);
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using nonleaky IAF algorithm
-execution time = 1.586 s
+execution time = 0.900 s
</pre><img vspace="5" hspace="5" src="iaf_demo_06.png" alt=""> <pre class="codeinput">M = 5; <span class="comment">% fast decoding parameter</span>
fig_title = <span class="string">'decoding using nonleaky fast IAF algorithm'</span>;
fprintf(1,<span class="string">'%s\n'</span>,fig_title);
u_rec = func_timer(@iaf_decode_fast,s,dur,dt,bw,M,b,d,R,C);
plot_compare(t,u,u_rec,fig_title);
</pre><pre class="codeoutput">decoding using nonleaky fast IAF algorithm
-execution time = 0.256 s
+execution time = 0.209 s
</pre><img vspace="5" hspace="5" src="iaf_demo_07.png" alt=""> <p class="footer"><br>
Published with MATLAB&reg; 7.7<br></p>
</div>
@@ -178,7 +178,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -10,7 +10,7 @@
dt = 1/fs;
f = 32;
bw = 2*pi*f;
-t = linspace(0,dur,floor(dur/dt));
+t = [0:dt:dur];
np = -inf;

0 comments on commit e24e4c9

Please sign in to comment.