Mercurial > hg > ishara
annotate dsp/spec2ac.m @ 32:c3b0cd708782
Imported core dsp tools.
author | samer |
---|---|
date | Sun, 20 Jan 2013 13:48:47 +0000 |
parents | |
children |
rev | line source |
---|---|
samer@32 | 1 function R=spec2ac(A) |
samer@32 | 2 % SPEC2AC - convert power spectrum to autocorrelation sequence |
samer@32 | 3 % |
samer@32 | 4 % assumes that S is a half-spectrum. |
samer@32 | 5 % R=spec2ac(S) |
samer@32 | 6 |
samer@32 | 7 if isvector(A), A=A(:); end |
samer@32 | 8 |
samer@32 | 9 S=[A; A(end-1:-1:2,:)]; |
samer@32 | 10 R=real(ifft(S)); % autocorrelation |
samer@32 | 11 R=R(1:(1+size(R,1)/2),:); % extract first half (rest is symmetric) |
samer@32 | 12 |