diff dsp/spec2ac.m @ 32:c3b0cd708782

Imported core dsp tools.
author samer
date Sun, 20 Jan 2013 13:48:47 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dsp/spec2ac.m	Sun Jan 20 13:48:47 2013 +0000
@@ -0,0 +1,12 @@
+function R=spec2ac(A)
+% SPEC2AC - convert power spectrum to autocorrelation sequence
+%
+% assumes that S is a half-spectrum.
+% R=spec2ac(S)
+
+if isvector(A), A=A(:); end
+
+S=[A; A(end-1:-1:2,:)]; 
+R=real(ifft(S));					% autocorrelation
+R=R(1:(1+size(R,1)/2),:);		% extract  first half (rest is symmetric)
+