Mercurial > hg > ishara
annotate arrows/dsp/aspectrum.m @ 0:672052bd81f8
Initial partial import.
author | samer |
---|---|
date | Wed, 19 Dec 2012 22:38:28 +0000 |
parents | |
children | beb8a3f4a345 |
rev | line source |
---|---|
samer@0 | 1 % aspectrum - frequency spectrum arrow |
samer@0 | 2 % |
samer@0 | 3 % aspectrum :: |
samer@0 | 4 % N:natural ~'size of waveform blocks to expect' |
samer@0 | 5 % options { |
samer@0 | 6 % specfn :: ([[N,T]]->[[dftbins(N),T]])/ @powspec ~'function to compute spectra'; |
samer@0 | 7 % window :: (N:natural->[[N]]) / @hanning ~'function to compute window' |
samer@0 | 8 % } |
samer@0 | 9 % -> arrow({[[N,T]]},{[[dftbins(N),T]]},empty). |
samer@0 | 10 |
samer@0 | 11 function o=aspectrum(N,varargin) |
samer@0 | 12 opts=prefs('specfn',@powspec,'window',@hanning,varargin{:}); |
samer@0 | 13 specfn=opts.specfn; |
samer@0 | 14 w=spdiag(opts.window(N)); |
samer@0 | 15 o=arr(@fn); |
samer@0 | 16 function y=fn(x) |
samer@0 | 17 y=specfn(w*x); |
samer@0 | 18 end |
samer@0 | 19 end |