view dsp/realfft.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 [y,f] = realfft(x,nfft)
% realfft - Do FFT assuming real data, returning complex half spectrum
%
% realfft ::
%    [[L,T]->real]     ~'sequence of T L-point frames',
%    N:natural         ~'FFT size'
% -> [[M,T]->complex]  ~'sequence of T M-point complex spectra',
%    [[M]]             ~'normalised centre frequency for each bin'.
%      
% Note that M=dftbins(N).

% apply the window and do FFT on each column, then
% assume it's a real signal and discard half the bins
y = fft(x,nfft);
select=1:dftbins(nfft);
y = y(select,:);
% compute the normalised frequency for each bin
f=(select-1)/nfft;