view dsp/dftfmap.m @ 36:9e7be347b3a0

Renamed sequence classes to avoid clashes with seq methods; Fixed default slicing dimension while retaining behaviour of window.m; Updated use of sequences in dsp/synth.
author samer
date Thu, 24 Jan 2013 14:51:23 +0000
parents c3b0cd708782
children
line wrap: on
line source
function F=dftfmap(N,Fs)
% dftfmap - Frequency map for DFT of real signal 
%
% dftfmap :: N:natural, real ~'sampling rate' -> dmap(dftbins(N)).

	M=dftbins(N);
	F=dmap(M,@map,@revmap);

	function I=map(X)
		I=round(N*X/Fs);
		I(X<0)=-inf;
		I(X>Fs/2)=inf;
	end

	function X=revmap(I)
		I=shiftdim(shiftdim(I),-1);
		X1=Fs*(2*I-3)/(2*N);
		X2=Fs*(2*I-1)/(2*N);
		X1(I<=1)=0;
		X2(I>=M)=Fs/2;
		X=cat(1,X1,X2);
	end
end