Mercurial > hg > ishara
view dsp/mag_phase_split.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 o=mag_phase_split(N) % mag_phase_split - arrow to get FFT and do mag/phase split % % mag_phase_split :: % N:natural ~'frame size' % -> arrow( {[[N,L]]}, {[[M,L]], [[M,L]]},empty) :- M=dftbins(N). bins=1+floor(N/2); singles=1:ceil(N/2):bins; o=arr(@mps); function [S,P]=mps(X) Y=fft(X,N); Z=Y(1:bins,:); M=abs(Z); P=Z./M; % get complex phases of components. S=M*sqrt(2/N); % sqrt of double of total power per band S(singles,:)=S(singles,:)/sqrt(2); % undo double counting of singletons end end