Mercurial > hg > ishara
view signals/@sigfun/sigfun.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 289445d368a7 |
children |
line wrap: on
line source
classdef sigfun < signal properties (GetAccess=private, SetAccess=immutable) fun fs end methods function s=sigfun(fun,rate) s.fun=fun; s.fs=rate; end function s=tostring(sig), s=sprintf('sigfun(%s)',tostring(sig.fun)); end function c=channels(s), c=size(s.fun(0),1); end function c=rate(s), c=s.fs; end function s=construct(sig) fun=sig.fun; t=0; s.start = @nop; s.stop = @nop; s.dispose = @nop; s.reader = @reader; function r=reader(n) r = @next; T=(0:n-1)/sig.fs; dt=n/sig.fs; function [x,rem]=next, x=fun(t+T); rem=0; t=t+dt; end end end end end