Mercurial > hg > ishara
view sequences/expdata.m @ 2:7357e1dc2ad6
Simplified scheduler library with new schedule representation.
author | samer |
---|---|
date | Sat, 22 Dec 2012 16:17:51 +0000 |
parents | 672052bd81f8 |
children | 3f77126f7b5f |
line wrap: on
line source
function y=expdata(A,B,N,M) % expdata - exponential data sequence % % expdata :: % real ~'initial value', % real ~'final value', % natural ~'number of steps (sequence length is steps+1), % M:natural ~'buffer size' % -> seq [[1,M]]. if nargin<4, M=1; end lA=log(A); k=(log(B)-lA)/N; y=unfold(@ls1,0:M-1); %y=windowdata(linspace(A,B,N),M,M); function [X,I]=ls1(I), surp=I(end)-N; if surp>=0, X=exp(lA+k*I(1:end-surp)); if surp<M, X(end)=B; end else X=exp(lA+k*I); end I=I+M; end end